3 ms·
The trouble with a green thread system is that you can't opt out. Like the article's example of everything being implicitly cancellable by a higher-level select
by lmm 5y ago
The trouble with a green thread system is that you can't opt out. Like the article's example of everything being implicitly cancellable by a higher-level select, in a green thread system everything is implicitly threadshiftable by a lower-level function.
If your scheduler works right, then green threads are great, but when your scheduler breaks (and eventually it will) they're impossible to fix. Lightweight-but-not-invisible yields keep things as simple as possible, but no simpler.
- pjmlp 5y agoSure you can and that is one of the design ideas behind Project Loom or .NET Tasks. Have a scheduler API available that is able to take those decisions, while providing default schedulers for the most common patterns. Just like in many design decisions, Go design team just decided not to expose the same level of power to their users.