2 ms·
The writing is quite confusing - a "coroutine" is by definition cooperative (that's what the "co" means). I understand that this introduces a kind of user-space
by duped 4y ago
The writing is quite confusing - a "coroutine" is by definition cooperative (that's what the "co" means). I understand that this introduces a kind of user-space/green threading (as opposed to OS threads) but it's not clear if they're actually coroutines (can they suspend themselves/yield? Or is it purely preemptive?).
Some notes on the preemption mechanism would be cool too. One of the classic problems with a purely cooperative multitasking system is that the coroutines can become starved in hot loops. Iirc go fixed this by adding preemption using a timer. I've seen some applications use interrupts for this in embedded, but those are expensive too.