Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Personally I recommend Distinguishing coroutines and fibers (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



Is that kind of like how gevent for Python works? I thought they were coroutines but there's a scheduler, I think.


Fibers 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: