Gentoo Archives: gentoo-user

From: lists@×××××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Is my system (really) using nptl
Date: Sat, 13 Oct 2012 20:30:01
Message-Id: 20121013222821.08346ce9@gentp
In Reply to: Re: [gentoo-user] Is my system (really) using nptl by Timur Aydin
1 On Sat, 13 Oct 2012 23:13:31 +0300
2 Timur Aydin <ta@××××××.org> wrote:
3
4 > On 10/13/12 19:15, Canek Peláez Valdés wrote:
5 > > We can only know seeing the code. Timur, this is the little test I
6 > > made which creates 5 threads and runs them for 1 minute. In my case,
7 > > `ps x` shows only 1 PID, care to give it a try?
8 >
9 > I have re-read all messages and I noticed Canek writing about the 'ps
10 > x' output. I was using htop to watch what's happening. When I used
11 > 'ps x', I indeed saw just a single process. Looked around google for
12 > the difference between the two, and sure enough, htop by default
13 > shows all threads in a process, but ps does not. You have to supply
14 > special flags to ps to have it show the threads.
15 >
16 > So I started focusing on the pid's that htop is showing for my simple
17 > app's threads. When I try to locate them under /proc/<...>, they don't
18 > exist. Further search in google and indeed, the pid's shown for
19 > threads aren't really "process id's" in the traditional sense and
20 > there is no folder under /proc for them. My app has pid 12397 and one
21 > of the threads has pid 12404. To look up the thread pid, one needs to
22 > look under /proc/12397/task/12404.
23 >
24 > So, mystery (for me) solved. Thanks for all the replies!
25 >
26
27 Yes, you got it. When htop claims it's showing PIDs, it's actually
28 lying; in fact it's showing the TIDs (thread ids), and they're
29 different even for multiple threads within the same thread group. (For
30 processes with just a single thread however, TID and PID are equal)
31
32 Regards,
33 aranea

Attachments

File name MIME type
signature.asc application/pgp-signature