Hybrid Thread Model (M:N) Implementation Hybrid Thread Model (M:N) Implementation multithreading multithreading

Hybrid Thread Model (M:N) Implementation


First of all read this: http://www.kegel.com/c10k.html#1:1

Linux uses 1:1 threading model starting from kernel 2.6 (NPTL Native Posix threading library) and today almost all OSes move to this model:

  • FreeBSD starting from 7.0 if I'm not mistaken.
  • Solaris starting for some version also moved to 1:1 - I don't remember which one.

Once Linux had M:N model (this was in 2.4 NGPT) but 1:1 is generally superior.

The biggest problem with M:N model is:

  1. Hard to implement
  2. When using blocking system calls you actually need to notify somehow kernel to block only one user space thread and not kernel one
  3. In age of multi cores you want to have as much kernel threads as you can.

One of them is the hybrid (M:N) model in which some N threads of an application are mapped to some M available processors.

Small correction - N application threads mapped to M kernel threads so they can use up to M processors.