Dispatchers & Threading

KOTLIN › Coroutines

Which thread runs a coroutine: the built-in dispatchers, limitedParallelism, main-safety, and confinement.

Dispatchers are where coroutines meet real threads, so interviewers use them to check whether you understand the threading model underneath rather than the API on top. Expect to justify Main versus IO versus Default, explain why IO can exceed the core count when both share a pool, and say what withContext actually costs. Strong answers reach for limitedParallelism instead of custom pools, treat main-safety as a property of the function rather than a ritual at the call site, and inject dispatchers so the code stays testable.

What this covers

Study this topic

Further reading