Coroutines Under the Hood

KOTLIN › Coroutines

What suspend compiles to: continuations, the state machine, context elements, and interception.

Once you can use coroutines, interviewers start asking how they work, and this is where prepared candidates separate themselves. Expect to explain what suspend compiles to, what a Continuation actually is, why a suspended coroutine costs a heap object rather than a thread stack, and how a dispatcher gets control through ContinuationInterceptor. Strong answers derive structured concurrency from Job being a context element rather than treating it as a separate feature, and know the three things suspend does not mean.

What this covers

Study this topic

Further reading