[Gllug] Max number of pthreads in Linux ?

Nix nix at esperi.org.uk
Sat Mar 29 12:44:08 UTC 2008


On 26 Mar 2008, Richard Jones verbalised:
> Processes scale over NUMA architectures, and MPI (and similar) scales
> over clusters.  They are safer and easier to use because all sharing
> and synchronization needs to be explicit, and it's more predictable
> because factors like false sharing don't come into play.  These
> factors are such a win so why would anyone want to use threads?

It's good for lazy programmers because you don't have to think about
what you want to share between threads, you just do it when you want to.

It's bad for the same reason, as you said: lots of unpredictable bugs
unless you think about concurrency properly, and if you did *that* you
could just have made them separate processes.

There is a small performance boost when switching between threads of the
same process on the same CPU because the mm context doesn't have to be
torn down, but there's often a performance *loss* on multiple CPUs
because of cacheline bouncing.

Threads strike me as one of those ideas that's really great where
necessary (e.g. when sharing is unavoidable, e.g. in kernel space) and
otherwise really silly.

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