简体   繁体   English

为什么多对多线程model没有在more中使用

[英]Why is the Many-to-Many threading model not used in more

The book Operating System Concepts talks about the various multithreading modules (section 4.3), it mentions that the one-to-one model is used in most operating systems; 《操作系统概念》一书讨论了各种多线程模块(第 4.3 节),它提到在大多数操作系统中都使用一对一的 model; Linux, Windows, etc. However, it then talks about the Many-to-Many model and that it fixes some of the issues that are seen with the One-to-One model, but later mentions that the only largely used implementation of it is with the two-level model which is just an extension of the Many-to-Many model which was used in an older version of Solaris (9) but is now no longer used and has been replaced by the one-to-one model. Linux, Windows, etc. However, it then talks about the Many-to-Many model and that it fixes some of the issues that are seen with the One-to-One model, but later mentions that the only largely used implementation of it与两级 model 一起使用,它只是多对多 model 的扩展,后者在旧版本的 Solaris (9) 中使用,但现在不再使用,已被一对一 Z20F35E630DAF399DFA868 取代. My question is if the Many-to-Many model is better then why is it not used more commonly?我的问题是,如果多对多 model 更好,那么为什么不更常用呢? Is it due to complexity?是因为复杂吗? I can imagine there could be issues with context switching if there was not some sort of a "sticky" mapping between user and kernel-level threads?我可以想象如果用户和内核级线程之间没有某种“粘性”映射,上下文切换可能会出现问题?

Thanks for any help with this.感谢您对此的任何帮助。

It is used;它被使用; go routines in Go are precisely this, managed by the Go runtime. Go 中的 go 例程正是如此,由 Go 运行时管理。 As kernel memory became cheaper (because memory became cheaper) and pthreads use became ubiquitous, the runtime cost of managing the two level model, and the human time cost of supporting it, spelled its demise. As kernel memory became cheaper (because memory became cheaper) and pthreads use became ubiquitous, the runtime cost of managing the two level model, and the human time cost of supporting it, spelled its demise.

Go routines are a programming model, and meant to be extremely cheap, to the degree that Go programs shouldn't be ashamed to have thousands of them. Go 例程是一个编程 model,并且意味着非常便宜,以至于 Go 程序不应该为拥有数千个程序而感到羞耻。 The Go runtime, very carefully keeps a virtual-cpu pool (constructed with real threads), that can adopt a go routine very quickly. Go 运行时,非常小心地保留了一个虚拟 CPU 池(由真实线程构建),可以很快采用 go 例程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM