debugging threads vs processes

Cedric Berger cedric@wireless-networks.com
Thu Jul 12 17:32:00 GMT 2001


Per Bothner wrote:

> One problem is how I can get a list of running processes vs threads?
> On my RedHat 7.1 (Pentium3) ps -m says "Thread display not
> implemented."  My impression is that both ps and top
> list all threads, not just all processes.  This is my
> conclusion from looking at various 'top' displays which show
> a bunch of "processes" using more memory in lock-step,
> which only seems plausible of these "processes" are
> actually threads in the same process.  But it sure would be
> nice to have a way of showing threads vs processes more clearly.
>
> Another confusing thing is that getpid seems to return s thread id,
> not a process id.

Unfortunately, under Linux, as you saw, a thread is a just
a process that shares some characteristics with other "processes"
(like VM) Both threads and processes can be created by the
clone() system call. (clone = fork with more options)

This thread/process stuff is a major pain, and the main reason why
I like better running java applications under Solaris/X86 :(

Cedric




More information about the Java mailing list