Hybrid Thread Model (M:N) Implementation

前端 未结 1 835
囚心锁ツ
囚心锁ツ 2020-12-29 11:56

There are three thread models that are used in thread scheduling implementations usually done by OS Kernels. One of them is the hybrid (M:N) model in which some

相关标签:
1条回答
  • 2020-12-29 12:15

    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.

    0 讨论(0)
提交回复
热议问题