3 ms·
Green threads (today) aren't a singular thing, the definition is that they're in user space not kernel space. They are implemented in a variety of ways: https:
by Jtsummers 4y ago
Green threads (today) aren't a singular thing, the definition is that they're in user space not kernel space. They are implemented in a variety of ways:
https://en.wikipedia.org/wiki/Green_thread https://en.wikipedia.org/wiki/Green_thread
Do you imitate a more traditional OS-thread style with preemption, do you use cooperating tasks, coroutines, what? Since there is no singular best or consensus model, there is little reason for an OS to adopt wholesale one of these variations at this time.
The original green threads (from that page) shared one OS thread and used cooperative multitasking (most coroutine approaches would be analogous to this). But today, like with Go and BEAM languages, they're distributed across real OS threads to get parallelism. Which approach should an OS adopt? And if it did, would other languages/runtimes abandon their own models if it were significantly different?
- smasher164 4y agoPreemptive threads with growable stacks. There was some discussion around getting segmented stacks into the kernel, but I'm not sure that's the best approach. There might have to be some novel work done in making contiguous stacks work in a shared address space.