[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: top processes



On Thu, 01 Feb 2001, kmself@ix.netcom.com wrote:
> on Thu, Feb 01, 2001 at 08:05:58AM -0800, Eric G . Miller
> (egm2@jps.net) wrote:
>> On Thu, Feb 01, 2001 at 03:10:42PM +0100, William Leese wrote:
{licq shows up in top multiple times per window}
>> 
>> Threaded processes show up as separate processes.  And/or, if licq
>> actually has some fork() calls, those will be separate processes.
>> Not to worry...
> 
> FWIW, mozilla behaves similarly.
> 
> I believe this is brokenness in either top or GNU/Linux's thread
> handling, though I'm really blowing smoke and am inviting the cudgel
> of enlightenment's application....

I wouldn't call it brokenness.  Threads are implemented with the clone
system call.  This is in turn calls the do_fork() function in the
kernel.  Guess what do_fork() does.  If you said, "It makes a new process
with a new pid (process ID)", you were right.  

Since top looks at different pids (through /proc), it shows a
multi-threaded process multiple times.  top has no way of knowing if a
process is multi-threaded or not, it just reports what it sees in
/proc.  Also, while it could be possible to implement things some
other way in the kernel, the way it is done makes sense.  (If my
blessing is worth anything, which it's really not.)

The upshot is that top output can be confusing.  Don't panic though;
all threads share the same memory space.  

Cheers,
Chris

-- 
Got jag?  http://www.tribsoft.com



Reply to: