[ale] differentiating processes from threads

Danny Cox danscox at mindspring.com
Tue Apr 2 08:39:22 EST 2002


John,

On Tue, 2002-04-02 at 03:17, John Wells wrote:
> 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?

	Okay, here is that previous message.  I hope it'll do!

On Fri, Feb 08, 2002 at 07:53:43AM -0500, Danny Cox wrote:
>       My mozilla(-bin) is currently using 13024 K of mem.  Large, but
> not too bad (sheesh! who remembers when 65k was all the addresses 
> ya got? ;-).

        I did find one (small) distinction using the esoteric command:

                ps -eo pid,flags,user,args

the mozillas look like this:

 1492 000 danny    /home/danny/src/mozilla/mozilla-9.8/mozilla-bin
 1494 040 danny    /home/danny/src/mozilla/mozilla-9.8/mozilla-bin
 1495 040 danny    /home/danny/src/mozilla/mozilla-9.8/mozilla-bin
 1496 040 danny    /home/danny/src/mozilla/mozilla-9.8/mozilla-bin
 1597 040 danny    /home/danny/src/mozilla/mozilla-9.8/mozilla-bin

        The '040' in the 'flags' field means 'process forked but didn't
exec', which while true, doesn't mean exactly 'process is a thread'. 

	The main problem is that on Linux, a thread *is* a process.  It simply
shares it's data space and file descriptors with at least one other
process.  See 'man 2 clone' for more info.

	Hope this helps!

-- 
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.

Danny


---
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