3 ms·
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
by rurban 8y ago
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.