[ale] differentiating processes from threads

hirsch at zapmedia.com hirsch at zapmedia.com
Tue Apr 2 09:07:40 EST 2002


John Wells writes:
 > Awhile back I sent out a message regarding mozilla's apparent spawning of
 > multiple processes with large memory footprints.  Someone corrected me,
 > stating that these were actually threads using shared memory and were just
 > reported by top and ps -ef as seperate processes.  They forwarded a ps
 > string that returned some obscure indication of the fact that they were
 > threads.
 > 
 > I find myself in a situation where I need to be able to differentiate
 > processes from threads.  Can anyone help me out?  The previously mentioned
 > ps string would do, but I wonder what other ways exist?

I don't think there is a really good method.  Since the kernel doesn't
distinguish threads from processes, there is no fool-proof means.

A good heuristic is to look at the file descriptors in /proc/<pid>.
If they are identical they are probably the same process.  Again, not
necessarily. 

--Michael


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list