Re: Re: program starts with 3 threads
On Fri, 2004-07-02 at 16:50, jono wrote:
> Thanks Simon, that makes a lot of sense. I've just read the ps man page
> but cant find out if I can show only processes not threads. Any idea if
> this is possible or any another tool that could do it?
I'm not personally aware of any easy way to tell threads and processes
apart on 2.4.x kernels. All of the "thread" entries reported by "ps"
should be traceable back to the real process PID via their parent PID,
but I don't know how to tell the difference between this and a tree of
true child processes.
I believe that in 2.4 the threads are essentially separate processes -
they just happen to share the same virtual->physical memory map. Because
the kernel keeps separate entries in the process table for them, ps sees
lots of processes. And "ps" doesn't bother to look into whether they
have the same virtual memory mappings as their parent process (ie are
threads) or not (are traditional child processes).
Maybe there is a way to tell by looking in /proc...
I'm sure others have experienced this issue. Google could well be your
friend. I would try "NPTL" (Native Posix Thread Library); I think this
is the code that ended up in 2.6.x, and is probably the code that RH
included in 2.4.x as a vendor patch.
> Other than that I suppose a kernel patch or upgrade would do it.
Yes, I expect that running kernel 2.6.x on debian would do it. I don't
know if that's an option for you. If you are running a "production"
server then maybe not...
I certainly wouldn't recommend trying to patch 2.4 to include an
alternate threading model like Red Hat did :-).