A coroutine is a lightweight concurrency task whose switching is controlled by the program rather than the operating system. Several coroutines can act within one thread, sharing that thread’s execution resources. section 10.5
Coroutines trade isolation for lower overhead. They cannot protect one another from a blocked thread: if that thread waits for console output, none of its coroutines can progress. Threads, processes, and virtual machines provide progressively stronger isolation, but generally require more overhead. section 10.5
Figure 10.5 Trade-offs relating to different forms of task isolation in computing. In general terms, increasing the isolation level increases the overhead.
Compare coroutine-style task sharing with processes, threads, and virtual machines through the isolation-versus-overhead trade-off. section 10.5







