system scope vs. process scope

Jeremie Le Hen jeremie at le-hen.org
Fri Aug 4 14:06:29 UTC 2006


Hi,

occasionally, I saw environnement variables LIBPTHREAD_SYSTEM_SCOPE and
LIBPTHREAD_PROCESS_SCOPE mentionned hither and thither.  I grep(1)'ed
through the source tree for some documentation, but I wasn't able to
find any.  Read the source Luke...

It seems that the PTHREAD_SCOPE_SYSTEM thread attribute is the default.
Intuitivelely, I would say that setting the PTHREAD_SCOPE_PROCESS
attribute creates a new process with its address space being shared with
the other userland threads (a la Linux) whereas the default behaviour is
to create a new kernel thread.

Am I right ?  What are the pros and cons of either methods ?

In libthr, it seems those environnement variables / attributes leads to
set a flag THR_SYSTEM_SCOPE which doesn't seem to be used in the library
nor in the kernel.

OTOH, in libpthread (libkse), it seems to be widely used.  I fumbled
through the code, but I am not sure to understand what these flags really
do.

Thank you.
-- 
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >


More information about the freebsd-threads mailing list