Threading arch quetions

Julian Elischer julian at elischer.org
Tue Dec 5 09:32:20 PST 2006


Joshua M wrote:
>> From: Julian Elischer <julian at elischer.org>
>> To: Joshua M <katsuo_harada_evil_does at hotmail.com>
>> CC: freebsd-threads at freebsd.org
>> Subject: Re: Threading arch quetions
>> Date: Mon, 04 Dec 2006 13:57:17 -0800
> 
>> We adopted a scheme which would allow us to implement both M:N threads
>> and 1:1 threads with compatible libraries that do it each way.
>> The hope was that this would allow people to experiment with these.
>> and for us to be able to select the best approach.
> 
> Thank you for your response.
> Can you please name those libs ?

/usr/lib/libpthread.so (also known in the past as libkse.so)  M:N 
library (though it can be configured to run 1:1)

/usr/lib/libthr.so  1:1 library
> 
>> There are examples where M:N outperforms 1:1 but they are the
>> minority, so we will be switching the default library to
>> 1:1 threads
> 
> What is the default library ?

libpthread.so  (for now)

> 
>>
>> Note that the kernel support for threads is the same for both models,
>> where processes have sub-entities (kernel schedulable entities) called 
>> threads, as opposed to in Linux where each thread is a separate process.
> 
> This is the point i dont understand at all. As i understood KSE is an N 
> to M approach and it is implemented in FBSD. So how 1:1 is supposed to 
> coexist if finally everythig is converted to N to M ? does it mean that 
> basically FBSD if it wants 1 to 1 always creates 1 KSEG per thread and 
> thus create a *simulation* of 1 to 1 approach ?


in M:N threading, you only create a small number of kernel threads.
Whenever a user thread goes into the kernel and BLOCKS there, you create
a new kernel thread  and allow it to go back to userland in place of teh 
one that blocked, to give the userland threads a chance to keep running.


in 1:1 threading you create more kernel threads.. one for each user 
thread, so  when  one blocks, no extra work is needed.. the other user 
threads already HAVE the capacity to keep running.

nothing is simulated..

> 
> Thank you again.
> 
> _________________________________________________________________
> Windows Live Spaces : créez votre Space à votre image ! 
> http://www.windowslivespaces.fr/



More information about the freebsd-threads mailing list