混合线程模型(M:N)实现 [英] Hybrid Thread Model (M:N) Implementation

查看:342
本文介绍了混合线程模型(M:N)实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

三个线程模型,这些线程模型通常由OS Kernels完成,用于线程调度.其中之一是混合(M:N)模型,其中某些N应用程序线程被映射到M内核线程,因此它们最多可以使用M处理器.此模型有优点也有缺点.优点之一是,基于此模型的语言将引入语言级别的调度程序实现,该实现负责管理和调度应用程序级别的线程.

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 N application threads are mapped to M kernel threads so that they can use up to M processors. There are pros and cons to this model. One of the advantages is that the languages that are based on this model will introduce a language level scheduler implementation that is responsible for management and scheduling the application-level threads.

  • 我想知道是否有人知道任何努力或已经完成的工作,以便某种语言或图书馆可以利用它?
  • 例如,考虑到内核2.6.23+使用称为CFS的算法进行调度的事实,您认为这种混合模型完全是投资的明智方法吗?

推荐答案

首先阅读以下内容: Linux从内核2.6(NPTL Native Posix线程库)开始使用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从7.0开始.
  • 从某个版本开始的Solaris也已更改为1:1-我不记得是哪个版本.

一旦Linux有了M:N模式(这是在2.4 NGPT中),但是1:1通常是更好的.

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

M:N模型的最大问题是:

The biggest problem with M:N model is:

  1. 难以实施
  2. 使用阻塞系统调用时,您实际上需要以某种方式通知内核仅阻塞一个用户空间线程而不阻塞内核
  3. 在多核时代,您希望拥有尽可能多的内核线程.

其中之一是混合(M:N)模型,其中应用程序的N个线程映射到M个可用处理器.

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

小校正-N个应用程序线程映射到M个内核线程,因此它们可以对M个处理器使用 up .

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

这篇关于混合线程模型(M:N)实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆