[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BSD vs Linux Threads



> Which always seemed silly to me... Just FWIW, there are threads packages
> (later versions of C threads?) that would do this with Mach.
> 

Ok, it may seem silly(did to me at first)but it makes sense when you think
about it a little. First, the big differences between userland and kernel
threads. You can only use multiple processors efficiently(in a UNIX model at
least)with kernel threads because you need to access hardware a lot and that
many syscalld is very inefficient. Userland threads can be written for almost
any system but often limit other resources(ex. certain signals are no longer
available, etc.) Userland threads tend to be more efficient and run faster(if
well written)than kernel threads because a program has to cross the
userland/kernel barrier less often(this takes time because you ave to trap).
Also, userland schedulers, etc. tend to be more flexible because you can
achange them without changing the kernel.

I'm working(infant stages)on kernel'ish thread support for OpenBSD which will
hopefully lead to multiprocessor support. I'm going to use a system similar to
Solaris. Actually, it's based on a paper whose title and author I can't
remember off-hand(mail me if you are really interested in it). It uses a hybrid
model where scheduling, etc. is done in userland. The kernel provides a pool of
"virtual processors." Basically, the kernel divides processors up among
processes with multiple threads. It uses a signal system to tell the
process when it adds or removes processors. The process can request fewer or
more processors with a couple of syscalls. The complete system(a little more
complex than the above explanation, but not much more)does a good job of
reducing the number of kernel entrances and maintaining scheduling flexability
and speed.
------------------
Trevor R.H. Clarke                     Computer Science House
Rochester Institute of Technology      Systems Programmer for ISC
retrev_(_at_)_csh_(_dot_)_rit_(_dot_)_edu                     trcsys_(_at_)_rit_(_dot_)_edu
http://www.csh.rit.edu/~retrev/        finger retrev_(_at_)_csh_(_dot_)_rit_(_dot_)_edu for PGP key



Visit your host, monkey.org