Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Dear Pearlseattle
First of all, thanks for your response.
We have a program which creates many threads. I want to monitor the threads. The threads are POSIX using pthread library.
The utilities ps, mpstat, iostat give information on the process level.
Hi
I might be wrong (anybody wants to comment?) but such threads are handled the same way as processes - meaning that if your run e.g. htop (or ps, etc...) and you spawn a thread, you'll see it running with its own PID (different from the parent process).
THREAD DISPLAY
H Show threads as if they were processes
-L Show threads, possibly with LWP and NLWP columns
-T Show threads, possibly with SPID column
m Show threads after processes
-m Show threads after processes
Also, practically everything you would ever want to know about a particular thread can be found in files under /proc/[PID]/task/[TID].
Dear Millgates
Thanks for your answer.
Indeed top gives me the threads but the TID is not part of the information. Instead, I get a different PID for each POSIX therad.
Is there a way to get the TID also?
The information related to the thread is very interesting. How to get either he TID or the thread name while execution. We ran the top and ps utilities as a child process to the main process running the threads and record he information.
Thanks,
Yehuda
Last edited by YehudaSinger; 04-06-2015 at 05:11 AM.
Dear Millgates
Thanks for your answer. here are my remarks:
1, The TID is not the thread ID which is obtained either during the creation or by the thread_self)_'
2. The TID is obtained by the system call gettid(). This function is not in the libc. Hence, we call it by the following sequence: syscall(SYS_gettid) ;
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.