Coroutine A coroutine is a function that can suspend its execution to be resumed later. It may have many suspension points. It has much lighter overhead than threads and the context switching does not cost as much as threads’ because it does not rely on system calls.
It is particularly useful when there is a lot of I/O bound tasks to do as it may yield to others when doing such tasks to achieve concurrency.
Also, it does cooperative multitasking so data integrity is not broken like preemptive multitasking in threads.