NetBSD: Native POSIX Threads, Scheduler Activations

Submitted by Jeremy
on January 20, 2003 - 6:28pm

Following last October's merge for SMP support [story], NetBSD has now merged support for native pthreads. The implementation by Nathan Williams and Jason Thorpe is a two-level thread system known as Scheduler Activations, as described in this very interesting and informative usenix paper by Nathan Williams. In a recent posting to the NetBSD-announce mailing list, Jan Schaumann explained:

"With the Scheduler Activations based work that Jason and Nathan made, this is a very efficient implementation that can map N userland threads to M kernel threads, and there is no need to have one kernel thread for each userland thread, like some other systems (used to?) have, and which kills performance for many threads."

For a complete explanation of the recent merge, read on for Jan's full email.


From: Jan Schaumann
To: netbsd-announce
Subject: NetBSD now has native pthreads!
Date: Sun, 19 Jan 2003 17:14:49 -0500

http://www.netbsd.org/Changes/#merge-nathanw_sa

After NetBSD supports symmetric multiprocessing (SMP) on a number of
systems for some time now, support for native threads was added by merging
the nathan_sw branch that contains a Scheduler Activations based threads
implementation by Nathan Williams and Jason Thorpe.

SMP means running processes on more than one CPU in parallel. (With some
care-taking from the kernel that both CPUs don't step on each other with
respect to writing to kernel data structures etc.).

Threading means splitting up a process into several (well :) threads, and
let them run on either one or more than one CPU. This is basically an
application-layer issue, in contrast to SMP which happens inside the
kernel. Having SMP available helps for performance in threads systems as
threads can be ran in parallel on several CPUs, but SMP is not strictly
necessary for a threaded system.

Many applications today use a threaded software architecture (over the
classical Unix "fork"ed processes), and so having some efficient threads
implementation is an important goal of the NetBSD project.

With the Scheduler Activations based work that Jason and Nathan made, this
is a very efficient implementation that can map N userland threads to M
kernel threads, and there is no need to have one kernel thread for each
userland thread, like some other systems (used to?) have, and which kills
performance for many threads.

With native threads now available in NetBSD-current, applications from
pkgsrc will readily pick it up upon rebuild, and things will be fixed over
the coming time.

For instructions on how to port existing applications and to use threads
in your own programs using the new libpthreads that come with NetBSD now,
see http://www.humanfactor.com/pthreads/.

(Thanks to Hubert Feyrer  for the detailed press
release.)

-- 
http://www.netbsd.org -
         Multiarchitecture OS, no hype required.

Credits

on
January 27, 2003 - 9:18pm

I'd just like to clarify the credits: I did not participate in the implementation, I merely posted the announcement to various sites. The overwhelming majority of the work performed on the nathanw_sa branch was done by Nathan Williams; while others helped out, he deserves most of the credit as Jason Thorpe, who actually merged the branch with HEAD, is happy to point out.