A coroutine is a work unit for an event loop/scheduler and can be understood as a suspendible function. The “co” in coroutine does not stem from the word concurrent, but rather from the word cooperative .
The coroutine “cooperates” with the event loop that schedules the coroutine. If the coroutine is “logically blocked,” meaning it waits on some sort of I/O, the coroutine can yield control back to the event loop. The loop can then decide how to use the freed resources (CPU time) to dispatch other “waiting and ready” coroutines. The loop can then ...