混合线程模型 (M:N) 实现
通常由操作系统内核完成的线程调度实现中使用了三种线程模型。其中之一是混合 (M:N
) 模型,其中一些 N
应用程序线程映射到 M
内核线程,以便它们可以使用最多 M
个处理器。这种模式有优点也有缺点。优点之一是基于此模型的语言将引入语言级调度程序实现,负责管理和调度应用程序级线程。
- 我想知道是否有人知道任何已经完成此工作的努力或工作,以便语言或图书馆可以利用它?
- 例如,考虑到内核 2.6.23+ 使用名为 CFS 的算法进行调度,您认为这种混合模型是否是明智的投资方法?
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.
- I was wondering if anyone knows any effort or a work that already has done this so that a language or library could take advantage of it?
- Considering for instance the fact that Kernel 2.6.23+ uses an algorithm called CFS for scheduling, do you think that this hybrid model would at all be a wise approach to invest on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先阅读以下内容: http://www.kegel.com/c10k.html#1 :1
Linux 从内核 2.6(NPTL Native Posix 线程库)开始使用 1:1 线程模型,今天几乎所有操作系统都转向这个模型:
Linux 曾经有 M:N 模型(这是在 2.4 NGPT 中),但 1:1 通常更优越。
M:N 模型的最大问题是:
小修正 - N 个应用程序线程映射到 M 个内核线程,以便它们可以使用最多 M 个处理器。
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:
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:
Small correction - N application threads mapped to M kernel threads so they can use up to M processors.