by kqueue · 16y ago · 0 comments
Now compare that to coroutines, where you can switch between 10000 threads in the userland.
If you want to take advantage of cores when using coroutine, then run several coroutine schedulers, each in a pthread, and let them communicate over local sockets.
Doing it efficiently is an art and the OS is a lot more efficient than you, even with all the context switching. Going async is premature-optimization in my opinion, especially since with a Java server you can get to a couple thousands of synchronous requests/second easily.
You also missed the point of the fucking article.
There isn't much scheduling about coroutines, you wake up the coroutine on the event that it slept on (read/write/sleep), that's it. If you want to prioritize, you can do so, but with minimal advantage.
>Doing it efficiently is an art and the OS is a lot more efficient than you, even with all the context switching
At this point, I am pretty sure you don't understand context-switching and its implications, and you don't know how coroutines work.