Coroutines for Kotlins
Kotlin coroutines are lightweight, suspendable computations from the kotlinx.coroutines library that let you write asynchronous code in a sequential style. They are launched in scopes with builders like launch and async, and Flow extends them to streams of values that arrive over time.
Stage: Concurrency · Part of the Kotlin roadmap · Last reviewed 19 November 2026
What to learn in Coroutines
- Mark functions as suspend and call them from launch and async builders
- Choose a dispatcher such as Default, IO or Main for the right kind of work
- Run independent tasks concurrently and combine their results with async and await
- Build cold streams with Flow and collect them with operators like map and filter
- Explain the difference between StateFlow and SharedFlow
Coroutines interview questions
What is the difference between launch and async?
launch starts a coroutine for side effects and returns a Job, with no result value. async starts a coroutine that computes a value and returns a Deferred, whose result you get with await. Exceptions in async surface when you call await or when the parent scope fails.
Why is a coroutine cheaper than a thread?
A coroutine is a suspendable state machine managed by the library, not an operating system thread. Suspending frees the underlying thread to run other work, so thousands of coroutines can share a small thread pool without the memory and context switching cost of that many threads.
Where Coroutines fits in the Kotlin roadmap
Coroutines belongs to the Concurrency stage (intermediate level), which takes about 16 hours. Coroutines.
Other units in this stage
Back to the full Kotlin roadmap