This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: debugging threads vs processes
- To: per at bothner dot com, java-discuss at sources dot redhat dot com
- Subject: Re: debugging threads vs processes
- From: "Nic Ferrier" <nferrier at tapsellferrier dot co dot uk>
- Date: Fri, 13 Jul 2001 01:35:52 +0100
>>> 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