Subject: Re: pthread_create() and more than 1 CPU
To: None <current-users@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: current-users
Date: 12/02/2004 20:44:41
In article <200412021222.18710@-gryphon>,
Michael Graff <explorer@flame.org> wrote:
>-=-=-=-=-=-
>
>So, I have a little program I'm using to torture test a bit of code I have to 
>make certain I have the locking code right.
>
>I am using pthread_create() to create the threads.  They all start, then 
>eventually exit.  However, at no time does ps display more than one LWP in 
>use, and at no time does it consume all the CPU resources available on the 
>machine.  It seems to use only one CPU.
>
>I have set the undocumented and magical value PTHREAD_CONCURRENCY in my 
>environment to 2, and now it runs with 2 LWPs and uses 200% CPU.  Whee.
>
>Would it Really Break anything if I applied this patch?  It will make it so a 
>process by default uses ncpu for its maximum concurrency, which really seems 
>more in line with every other OS out there.  Other than Solaris, of course, 
>where pthread_setconcurrency() must be called to set the limit up to ncpu.  I 
>suppose we could implement that as well, but I'd rather see libpthread do 
>what most people expect -- use ncpu by default.
>

IIRC, and please correct me if I am wrong, setting this to 1 by default is
a conservative setting meant to be transitioned out of when we felt like
Christian's changes to handle multiple CPU's were stable. I think that it
is fine to turn this on for /current, otherwise we are never going to find
and fix any bugs. But please don't make the change based only on my opinion,
ask core or get a consensus.

christos