HEADS UP! 6.0-RELEASE coming

Robert Watson rwatson at FreeBSD.org
Tue Nov 1 07:29:58 PST 2005

On Tue, 1 Nov 2005, Scott Long wrote:

> There is little difference between 1:1 and M:N from the application's 
> point of view.  Both will allow multiple application threads to run 
> concurrently on multiple CPUs, and both will allow other process threads 
> to run when the current thread blocks in the kernel.  The difference is 
> in the details with how they are scheduled and what kernel resources 
> they use.  1:1 has the advantage of being much less complex to implement 
> and maintain, while M:N has the theoretical advantage of cheaper thread 
> context switches.  That theory hasn't panned out, though, due to 
> synchronization requirements and the technical requirements of proper 
> TLS support.

I've observed at least one situation in which m:n threading has performed 
significantly better as a result of better use of CPU resources. 
Specifically, it appears (on face value) as though libpthread is avoiding 
over-contention of resources by limiting the number of threads entering 
the kernel in contentious situations on SMP. I've not yet had the 
opportunity to confirm this outside of micro-benchmark environments, and 
plan to do so in the next few weeks.  This doesn't mean that this is 
impossible to do with libthr, just that we may need some more scheduler 
investigation to make libthr catch up on SMP in that environment.  Details 
to follow as available.

Robert N M Watson

More information about the freebsd-stable mailing list