I often hear that linux threads are heavy (requiring 8mb stack size) and this is why languages like golang implement their own green threads in userspace (allocating to the heap). This then allows handling say 100k connections instead of 10k connections. As I understand it, one problem with this is interop with C, and that this is why Rust moved away from them and went with async/await.
But if green threads are so popular, why can't Linux provide its own extremely light weight threads? In other words, why does every language needs to have its own complex thread scheduler ontop of the OS scheduler, when the OS seems better placed to make these scheduling decisions?
Asked by flippanthomework
(13 rep)
May 26, 2024, 05:56 PM
Last activity: May 26, 2024, 06:24 PM
Last activity: May 26, 2024, 06:24 PM