[Gllug] Max number of pthreads in Linux ?

Nix nix at esperi.org.uk
Mon Mar 31 23:03:37 UTC 2008


On 29 Mar 2008, Richard Jones verbalised:

> On Sat, Mar 29, 2008 at 02:39:41PM +0100, salsaman at xs4all.nl wrote:
>> I'm pretty sure they do - plus startup time is much quicker, shared memory
>> is done much easier, communication is simpler, locking can be done through
>> mutexes, etc.
>
> Really you should read Nix's reply to understand why this is wrong.

Actually if he's comparing fork()/exec() of a dynamically linked process
to threads, he's got a point: glibc's ld-linux.so.2 is rather expensive
to start up. On my fully-prelinked system here, I can manage 4600
fork-execs/sec of a trivial statically linked uClinux binary, versus
1300/sec of the same trivial binary compiled with glibc.

But this is rarely significant: most processes, even 'echo', do enough
work that ld.so startup time isn't very important... and the right model
to compare multithreaded apps to is programs that fork() and don't
exec(), or programs that fork()/exec() and then live a long time talking
to each other: and in that case the startup time difference of processes
over threads is utterly insignificant, reducing to the costs of a single
mm clone, as you say.

-- 
`The rest is a tale of post and counter-post.' --- Ian Rawlings
                                                   describes USENET
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list