Comment by toprerules
8 hours ago
Your confusing concurrency with parallelism. Async allows one core to switch between many threads of execution that can do work and not stop one thread of execution because it needs to wait for a resource. It's beneficial to use async if you're application is I/O heavy even if it's single threaded.
> Whereas async simply locks the CPUWhereas async simply locks the CPU
This is also completely nonsense, context switching behavior is OS dependent and your average general purpose kernel is not cooperative. You will run for your allotted quanta or reschedule when you run out of coroutines that can execute without waiting for resources.
> context switching behavior is OS dependent and your average general purpose kernel is not cooperative.
True, but if all you are using is async, then you're basically back at Windows 3.1 cooperative multitasking, except now within a Rust program.
Tokio uses a thread pool with work stealing so it is definitely more advanced than Windows 3.1's model!
As other commenters have pointed out, cooperative multitasking is actually a great fit for I/O bound code.