4 ms·
Personally I recommend Distinguishing coroutines and fibers (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4024.pdf http://www.open-std.org/jtc1/sc22
by htfy96 7y ago
Personally I recommend Distinguishing coroutines and fibers (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4024.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n402...)
In short:
- The key difference between fibers and kernel threads is that fibers use cooperative context switching
- When a coroutine yields, it passes control directly to its caller (or, in the case of symmetric coroutines, a designated
other coroutine).
- When a fiber blocks, it implicitly passes control to the fiber scheduler. Coroutines have no scheduler because they
need no scheduler
- Waterluvian 7y agoIs that kind of like how gevent for Python works? I thought they were coroutines but there's a scheduler, I think.
- icebraining 7y agoFibers can be built (and according to the paper, in C++ Boost they are) on top of coroutines, and that's essentially what both gevent and asyncio do.