Coroutines are a concurrency pattern that allows for concurrency without parallelism. Unlike traditional function calls, coroutines run concurrently on different stacks, allowing for shared data among themselves without races. The post explains the concept of coroutines using examples in Lua and Python. It also discusses the differences between coroutines, threads, and generators. The author argues that coroutines are a useful building block for writing programs that want concurrency for program structuring but not for parallelism. The post also explores the implementation of coroutines in Go and provides examples of using coroutines in different scenarios.
https://research.swtch.com/coro