4 ms·
No, they're saying the performance will be slightly degraded. But you can already spin up thousands of threads on Linux without performance problems. The M:N
by klodolph 13y ago
No, they're saying the performance will be slightly degraded. But you can already spin up thousands of threads on Linux without performance problems.
The M:N model is notoriously difficult, making your threading system 10x as complicated usually isn't worth the 10% performance increase. Haskell is, again, the exception that proves the rule. In Haskell there is no stack and no need for TLS, so the complexity of M:N threading is much lower. Additionally, on Haskell there is a provision for pinning green threads to OS threads if you need interoperability with foreign code that can't get moved across threads as easily, and the assumption is that you usually don't need to pin threads.
I'd also like to point out that for some applications, using native threads instead of green threads will reduce the number of context switches, it's when threads are CPU bound that green threads give you the biggest performance boost.
- pcwalton 13y ago> Additionally, on Haskell there is a provision for pinning green threads to OS threads if you need interoperability with foreign code that can't get moved across threads as easily, and the assumption is that you usually don't need to pin threads. You can do that in Rust too (and we do it a lot).