I have a multithread C++ program. I understand that each process has a pid and multiple threads have unique tid's . LWPid's are kernal level ids for the threads that process owns and pthreadId's are user level identifiers.
i tried to trace my program i could see, two traces with same pthreadId but different lwpid, how is this possible? (i am trying to run this program on Linux)
20170807 04:48:01.743 [pid:32174,pthreadId:139630838007552,lwpId:589][work] starter function
20170807 04:48:01.753 [pid:32174,pthreadId:139630838007552,lwpId:590][work] starter function
Related
I have a Macos application that is crashing, I'm trying to analyze the crash report and I see that a certain thread is the one that keeps on crashing in all of the reports.
Trying to associate that thread to my application thread, the report shows threads numbers (0 as main thread, thread 1, 2 and so on)
and they are totally different number from the thread ID I get from pthread_self / pthread_threadid_np
Anyway to connet between these number so I can find the problematic thread in my app ?
Thanks!
I need to write C++ program in unix system that allows user to run multiple processes (up to three at the same time) at the background. When three processes are currently running, further execution request will be pended (the process state is changed to “stopped”) and wait until another process is stopped or terminated. While processes are running at the background, the user can input commands to display information of the background processes, stop or kill a background process.
One of the commands is "bglist", whose function is to display the pid(s) of ALL background processes. For example, if I enter "bglist", it should show like this:
bglist
16529: demo1(running)
16605: demo2(stopped)
16613: demo3(terminated)
I have no idea how to check the status of ALL background processes while a program is running. Could anyone help me with the problem?
Is there a way to locate the master thread using Intel PIN? I have an application program in C where I have created some pthreads and wish to do some analysis on them in Pin. I have a PIN_AddThreadStartFunction(), which is the instrumentation routine that is invoked whenever a thread is created. The Pintool is written in C++.
Also is it possible to know from the PIN domain if how many threads are created, through the master thread?
The doc for PIN_AddThreadStartFunction routine says that the callback is called "even for the application's root (initial) thread." So that's how you identify the main, or as you called it, the master thread. It will be the first one for which the THREAD_START_CALLBACK is called. This is also how you find out how many threads are created. You simply enumerate them yourself in the same callback.
So, the profiler is written in c++ and is launched by the CLR automatically when the process to be profiled is launched. The process then launches another application (the main target of profiling). Profiler is launched for this process also. All this is taken care of, but the problem is:
Only one of these two profilers can communicate with the front end application via NamedPipe. I need both the profilers to write on the same pipe so that the front end application remains straight-forward and simple. Is this possible using some kind of semaphore to ensure that one of the processes write to the pipe at one time? I use the CreateFile() function to open the pipe in the profiler.
I have an application that I run with MPI for distributed computing. Let's say there are two MPI ranks started on a single machine, I start my target application on rank-0 which then spawns few threads. I want each of these threads to access a simple array[block] of data that was created by rank-1.
How can I do this? Shared memory?(Is it the only way). Can I use something in MPI(I'm a beginner)?
Thanks!