Subject: Re: Floating point in the kernel
To: John F. Woods <jfw@jfwhome.funhouse.com>
From: Curt Sampson <cjs@portal.ca>
List: tech-kern
Date: 09/18/1998 12:09:51
On Fri, 18 Sep 1998, John F. Woods wrote:

> ...if the kernel is aware of user threads and schedules them
> (as opposed to threads existing as figments of user processes' imaginations),
> then (a) you get non-blocking I/O for "free" (one thread blocking in I/O
> doesn't block other threads in that process), and (b) different threads of
> a process can make use of multiple CPUs...

Of course, you also get much more overhead when switching between
threads running on the same processor, because you've got to go
into the kernel.

As I understand it, the Solaris solution for this is to have
everything. :-) There are kernel threads, which are used by the
kernel. A kernel thread can also be mapped to a lightweight process
(LWP), which is basically a kernel-level thread used by a user
process. The user level threads library will map all of the user
threads on to one or more LWPs. (A process can also ask for a user
thread to have a dedicated kernel thread, if desired.) This lets
you have the efficiently of user-level thread switching when you
can do it, and the convenience of kernel threads for I/O and stuff
like that, if you want it.

(This information comes from Uresh Vahalia's book _Unix Internals:
The New Frontiers_, pp. 65-70. This is well worth reading if you're
interested in how SMP works in modern Unix systems.)

cjs
--
Curt Sampson  <cjs@portal.ca>  604-257-9400    De gustibus, aut bene aut nihil.
Any opinions expressed are mine and mine alone.
The most widely ported operating system in the world: http://www.netbsd.org