Re:Libaco: A fast and lightweight C asymmetric coroutine lib...
by rurban on Sunday July 15, 2018 @12:16AM
(#17533762)
The main difference is the low speed of threads (100 slower context switches) and the problems of parallelism: deadlocks, races.
Thats why you use threads for CPU bound tasks, and coros for IO bound tasks. With IO you don't need much CPU, you mostly wait. Coros provide fast switching back and forth until your IO is ready.
Thats why you use threads for CPU bound tasks, and coros for IO bound tasks. With IO you don't need much CPU, you mostly wait. Coros provide fast switching back and forth until your IO is ready.