We break down how, inside a single coroutine, you can locally switch the execution context using
withContext: what
CoroutineContext and
CoroutineDispatcher are, how
Dispatchers.
Default (CPU) and
Dispatchers.
IO (I/O) differ, why
withContext is
suspend, and why it does not provide parallelism. Using a mini-app (“cash register”) and thread logging as an example, we show switching, practical patterns, and common mistakes.