Is it possible to make -lpthread program to use 100% CPU?

Daniel Eischen eischen at vigrid.com
Sun May 2 09:57:54 PDT 2004


On Sun, 2 May 2004, Alexandre Sunny Kovalenko wrote:
> 
> I did mention this one ;) With older sources (kern_thread.c 1.175) I have tried
> both with the similar results. With the last update (last CTM from EST morning
> on Friday 4/30) I only tried _ULE. If you need me to try _4BSD, let me know.
> 
> Just out of curiosity, if I have 64 threads and 4 CPUs would not result be the
> same with PTHREAD_SCOPE_SYSTEM and PTHREAD_SCOPE_PROCESS, since I could not
> get more KSEGs then I have CPUs, and default is 8 threads per KSEG? Or am I
> totally off the mark?

You can have more KSEGs than CPUs.  The default is one KSEG
with N KSEs (where N is the number of CPUs).  All scope
process threads run in the N KSEs; these threads are not
bound to any specific KSE within the KSEG.

Scope system threads get their own KSEG and KSE.

I don't know how the various schedulers schedule KSEs
onto processors.

-- 
Dan Eischen



More information about the freebsd-current mailing list