linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to find all threads of a given process?
@ 2005-01-07  0:23 jesse
  2005-01-07  8:18 ` David Blomberg
  2005-01-07 11:58 ` Miquel van Smoorenburg
  0 siblings, 2 replies; 3+ messages in thread
From: jesse @ 2005-01-07  0:23 UTC (permalink / raw)
  To: linux-kernel

suppose I already know the PID of a process, how could
i quickly identify all threads of this process? 

As i know, under /proc, threads of all processes have
prefix ".", one way is to iterate each one and do the
check. the approach is too expensive. any other
suggestions?

for instance, 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to find all threads of a given process?
  2005-01-07  0:23 how to find all threads of a given process? jesse
@ 2005-01-07  8:18 ` David Blomberg
  2005-01-07 11:58 ` Miquel van Smoorenburg
  1 sibling, 0 replies; 3+ messages in thread
From: David Blomberg @ 2005-01-07  8:18 UTC (permalink / raw)
  To: linux-kernel


jesse said:
> suppose I already know the PID of a process, how could
> i quickly identify all threads of this process?
>
> As i know, under /proc, threads of all processes have
> prefix ".", one way is to iterate each one and do the
> check. the approach is too expensive. any other
> suggestions?
>
> for instance,

wouldn't this be easier in user space using "ps H" then one of two options
happens depending on the use of fork and other issues (making the question
hard to answer as stated) either A: they will all have the same PID or
B:they will all have varying PIDs in the later case you could use looks
for all PIDs sharing the same ancestor PPID (depending on how far down you
are in the fork list)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to find all threads of a given process?
  2005-01-07  0:23 how to find all threads of a given process? jesse
  2005-01-07  8:18 ` David Blomberg
@ 2005-01-07 11:58 ` Miquel van Smoorenburg
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel van Smoorenburg @ 2005-01-07 11:58 UTC (permalink / raw)
  To: linux-kernel

In article <20050107002333.21133.qmail@web52602.mail.yahoo.com>,
jesse  <jessezx@yahoo.com> wrote:
>suppose I already know the PID of a process, how could
>i quickly identify all threads of this process? 

With 2.6 and NPTL, you'll find them under /proc/PID/task

>As i know, under /proc, threads of all processes have
>prefix ".", one way is to iterate each one and do the
>check. the approach is too expensive. any other
>suggestions?

I've never seen anything like that. Is that a vendor-patched
kernel, something like Redhat 2.4 + NPTL support ?

Mike.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-07 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-07  0:23 how to find all threads of a given process? jesse
2005-01-07  8:18 ` David Blomberg
2005-01-07 11:58 ` Miquel van Smoorenburg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).