Subject: Re: 1:1 threading model
To: Bang Jun-Young <email@example.com>
From: Nathan J. Williams <firstname.lastname@example.org>
Date: 01/08/2003 13:33:35
Bang Jun-Young <email@example.com> 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.
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.
> 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.