Re:A little Golang way
by Scramblejams on Thursday August 06, 2015 @04:50AM
(#10015300)
Am I correct that coroutines are intrinsically non-preemptive? If so, I'll need to keep looking.
[ Parent
| on HN ]
Am I correct that coroutines are intrinsically non-preemptive? If so, I'll need to keep looking.
That's usually the case. Coroutines have their uses, but having used goroutines, that is my current preference.
Coroutines are preemptible at I/O boundaries or manual synchronization points. Those synchronization points could be inserted by the compiler, but if you do that you're back into goroutine land, which typically isn't better than 1:1. In particular, it seems quite difficult to achieve scalability to millions of threads with "true" preemption, which requires either stacks or aggressive CPS transformation.