Coroutines in C, revisited
This is a C++ coroutines framework( <a href="https:&#x2F;&#x2F;github.com&#x2F;markpapadakis&#x2F;coros-fibers" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;markpapadakis&#x2F;coros-fibers</a> ), but its trivial to “port” it to C.<p>I ‘ve also written a few things about coroutines and fibers(e.g <a href="https:&#x2F;&#x2F;medium.com&#x2F;software-development-2&#x2F;coroutines-and-fibers-why-and-when-5798f08464fd#.qz59082w0" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;software-development-2&#x2F;coroutines-and-fib...</a> and <a href="https:&#x2F;&#x2F;medium.com&#x2F;software-development-2&#x2F;high-performance-services-using-coroutines-ac8e9f54d727#.1s8lfoswb" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;software-development-2&#x2F;high-performance-s...</a> ).<p>Coroutines based on stack manipulation(as opposed to simple FSMs) are extremely powerful and are particularly useful for implementing fair scheduling across runnable ‘processes’ and concurrent execution contexts. 
Fair scheduling in particular can be really important in the domain of distributed systems that need to process potentially long-running and&#x2F;or expensive request which would otherwise stall processing other cheaper requests indefinitely. 
Combined with async I&#x2F;O, this gives near optimal concurrency and resources utilisation. 
Coroutines are often associated (literally and figuratively) with futures&#x2F;promises. See SeaStar framework for a great implementation of those ideas.