Subject: Re: 1:1 threading model
To: Nathan J. Williams <nathanw@wasabisystems.com>
From: Bang Jun-Young <junyoung@netbsd.org>
List: tech-kern
Date: 01/09/2003 04:23:22
On Wed, Jan 08, 2003 at 01:33:35PM -0500, Nathan J. Williams wrote:
> Bang Jun-Young <junyoung@netbsd.org> writes:
> 
> > Recently I read two papers on 1:1 threading, "Multithreading in the
> > Solaris Operating Environment" and "The new Native POSIX Thread Library
> > for Linux". Both of them describe how 1:1 outperforms M:N model (i.e. 
> > scheduler activations) with more simplicity in the userland code. 
> 
> I should note that Solaris's M:N thread implementation did not involve
> scheduler activations, and had a lot of thread-starvation issues and
> sub-par use of processor sets that the SA model doesn't have, so M:N
> doesn't imply SA.

Hmm, but on page 10 of the Sun article, 

	Scheduler Activation
	... In Solaris 2.6 software, this mechanism was augumented by the
	perferential use of a "door upcall."

> 
> Also, the NPTL paper doesn't actually cite any experience with M:N
> systems, just the beliefs among the Linux developers that it "wouldn't
> fit into the Linux kernel concept" and that their kernel overhead is
> low enough that it's not worth the complexity of M:N to avoid it.

Ulrich Drepper said that he succeeded starting and stopping 100,000
threads in 2 seconds in his article. Other people on the NPTL mailing
list reported good results with NPTL. So it doesn't look like just a
belief.

> 
> > Now I have a couple questions: even if nathan_sa branch is merged into
> > the main trunk in the (near) future, will we still be able to investigate
> > 1:1 threading model on the same code base? Is it possible to support both
> > models in the same kernel? For the latter, at least Solaris seems so.
> 
> Yes, it is possible. The LWP infrastructure resembles Solaris's a lot
> (by design) and can support concurrent LWPs within one process. There
> are some spots that would need to be fleshed out for a 1:1 POSIX
> thread implementation on top of LWPs (per-thread signal masks, for
> example, and kernel assistance for LWP-blocking synchronization
> primitives), but nothing fundamental.

Thanks for comments. Probably I need to switch my system to nathan_sa
branch first. 

Jun-Young

-- 
Bang Jun-Young <junyoung@netbsd.org>