debugging threads vs processes

Nic Ferrier nferrier@tapsellferrier.co.uk
Thu Jul 12 17:40:00 GMT 2001


>>> Per Bothner <per@bothner.com> 13-Jul-01 1:20:29 AM >>>

 Does someone on this list understand Linux threads 
 enough to explain what is going on and/or suggest 
 useful debugging tools?
I understand them a bit, enough I think to explain what's going on. I
apologise if this is not technical enough for you.
Linux threads are light weight processes. One creates them with the
clone() system call which does almost exactly the same as fork.
In effect they are created exactly the same as processes.
 One problem is how I can get a list of running 
 processes vs threads?
I'm not sure that's possible except through your app.
 The pid field is the result of getpid(), the prev field 
 is the value saved by the last request in a static 
 variable. ps -H claims that 16694 and 16697 are 
 siblings, not parent/child. But then how can 16697 
 remember a static value set by 16694? Unless they 
 are two threads in the same process, in which case 
 getpid is returning the thread id, rather than a process id.
Got me there. Are they both talking back to the data stored in the
parent?
Nic


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /