News for hackers. Stuff that matters.
Re:Coroutines in C by pengaru on Sunday February 25, 2024 @01:07PM (#39503142)
There's often a sweet spot to be had in mixing threads and coroutines, where you have a coroutine scheduler instance per thread, and a thread created per core.

Then rarely, if ever, migrate coroutines across schedulers, and rarely, if ever, share data between coroutines on different schedulers.

Coroutines can enable an ergonomic concurrent programming style while avoiding the need for any locking at all via cooperative scheduling. You generally end up with higher scheduling latencies, but potentially quite high throughput by removing any need for atomics/locking overheads, and no timer constantly interrupting execution for preemptive scheduling.

Re:Coroutines in C by rwmj on Sunday February 25, 2024 @03:11PM (#39504280)
Right, that's what qemu has ended up with.