Uploaded November 2026 | Updated November 2026, 3 hours ago
Find the accompanying project at: github.com/kotlin-hands-on/coroutines-four-hour-course
Talk Kotlin in person at KotlinConf 2027! Kraków · April 22–23. Get 24% off before December 10: kotl.in/vum6t5
Kotlin coroutines are a powerful tool for building concurrent systems that are both efficient and maintainable. To get the most out of them, it helps to understand how they work under the hood. That’s why, together with the Kotlin coroutines team, we created a free four-hour course to help you develop a good understanding and become productive with coroutines in Kotlin as fast as possible.
0:00:00 Welcome & course overview
0:01:37 Coroutines as lightweight threads
0:04:28 Core vocabulary: suspend functions, scopes & context
0:05:43 Concurrency vs. parallelism
0:07:08 Coroutines are computations that can be suspended
0:09:13 Comparison with alternative approaches
0:11:47 Meet the Articles project
0:16:57 Exercise: loading articles with suspend functions
0:20:13 Entering the world of coroutines: coroutine builders
0:24:13 Live demo: launch, async & Job
0:33:01 coroutineScope, async & Job in detail
0:37:10 async/await vs. plain suspend functions
0:39:04 runBlocking: bridging blocking & suspending code
0:42:00 Exercise: concurrent loading with async
0:44:55 Common async mistakes
0:48:33 Dispatchers: deciding which threads to run on
0:52:04 Passing dispatchers & withContext
0:54:57 Main safety: suspend functions must not block
0:57:39 Multithreaded dispatchers & shared mutable state
1:01:43 Shared state in a Ktor server
1:04:05 limitedParallelism is not a mutex
1:07:02 Recap: coroutine fundamentals
1:08:32 Structured concurrency
1:17:01 Live demo: structured concurrency
1:20:27 Live demo: coroutine context inheritance
1:23:29 Where coroutine scopes come from (viewModelScope, Ktor)
1:28:20 Taking a CoroutineScope as a parameter
1:32:11 coroutineScope vs. CoroutineScope: tricky naming
1:35:12 The CoroutineScope constructor & component lifecycles
1:39:52 Why to avoid GlobalScope
1:43:46 Coroutine context
1:48:12 Live demo: coroutine context
1:52:09 Cancellation
1:57:01 Cancellation in the Articles app
1:59:12 Quiz: where can this code be cancelled?
2:02:54 Cancellation is cooperative: isActive, ensureActive & yield
2:06:54 Don't swallow CancellationException
2:12:08 Exercises: CPU-heavy work & CancellationException
2:14:47 Cleaning up: finally, use & NonCancellable
2:17:32 Combining main safety & cancellability
2:18:20 Error handling: try/catch first
2:20:29 Exception propagation in coroutine hierarchies
2:22:42 SupervisorJob: error boundaries
2:25:01 Live demo: supervisorScope & async
2:29:41 Fixing the Articles app with a supervisor
2:31:58 CoroutineExceptionHandler
2:37:13 Exceptions in async & await
2:40:40 Error handling recommendations
2:42:09 Flows: beyond single values
2:44:27 Cold flows
2:49:54 Exercise: the Kettle temperature flow
2:54:59 Under the hood: Flow & FlowCollector
3:00:36 Exercise: progressive loading of articles
3:02:59 Concurrency inside flows: channelFlow
3:08:12 flow vs. channelFlow: which to pick
3:10:00 Hot flows
3:11:44 Live demo: a numbers station with MutableSharedFlow
3:17:10 SharedFlow replay
3:19:58 Exercise: chat broadcast with SharedFlow
3:23:23 shareIn: turning cold flows hot
3:24:52 Exercise: Fahrenheit in the Kettle app
3:28:38 StateFlow
3:32:58 stateIn & exercise: chat with priorities
3:36:11 Hot flows recap
3:37:25 Flow operators: intermediate vs. terminal
3:42:30 Exercise: writing a custom operator
3:45:36 Lifecycle & emission-control operators
3:48:22 Terminal operators
3:50:55 Error handling in flows: catch & retry
3:52:45 Exercise: retrying failed requests
3:55:14 Summary & goodbye
Find the accompanying project at: github.com/kotlin-hands-on/coroutines-four-hour-course
Talk Kotlin in person at KotlinConf 2027! Kraków · April 22–23. Get 24% off before December 10: kotl.in/vum6t5
Kotlin coroutines are a powerful tool for building concurrent systems that are both efficient and maintainable. To get the most out of them, it helps to understand how they work under the hood. That’s why, together with the Kotlin coroutines team, we created a free four-hour course to help you develop a good understanding and become productive with coroutines in Kotlin as fast as possible.
0:00:00 Welcome & course overview
0:01:37 Coroutines as lightweight threads
0:04:28 Core vocabulary: suspend functions, scopes & context
0:05:43 Concurrency vs. parallelism
0:07:08 Coroutines are computations that can be suspended
0:09:13 Comparison with alternative approaches
0:11:47 Meet the Articles project
0:16:57 Exercise: loading articles with suspend functions
0:20:13 Entering the world of coroutines: coroutine builders
0:24:13 Live demo: launch, async & Job
0:33:01 coroutineScope, async & Job in detail
0:37:10 async/await vs. plain suspend functions
0:39:04 runBlocking: bridging blocking & suspending code
0:42:00 Exercise: concurrent loading with async
0:44:55 Common async mistakes
0:48:33 Dispatchers: deciding which threads to run on
0:52:04 Passing dispatchers & withContext
0:54:57 Main safety: suspend functions must not block
0:57:39 Multithreaded dispatchers & shared mutable state
1:01:43 Shared state in a Ktor server
1:04:05 limitedParallelism is not a mutex
1:07:02 Recap: coroutine fundamentals
1:08:32 Structured concurrency
1:17:01 Live demo: structured concurrency
1:20:27 Live demo: coroutine context inheritance
1:23:29 Where coroutine scopes come from (viewModelScope, Ktor)
1:28:20 Taking a CoroutineScope as a parameter
1:32:11 coroutineScope vs. CoroutineScope: tricky naming
1:35:12 The CoroutineScope constructor & component lifecycles
1:39:52 Why to avoid GlobalScope
1:43:46 Coroutine context
1:48:12 Live demo: coroutine context
1:52:09 Cancellation
1:57:01 Cancellation in the Articles app
1:59:12 Quiz: where can this code be cancelled?
2:02:54 Cancellation is cooperative: isActive, ensureActive & yield
2:06:54 Don't swallow CancellationException
2:12:08 Exercises: CPU-heavy work & CancellationException
2:14:47 Cleaning up: finally, use & NonCancellable
2:17:32 Combining main safety & cancellability
2:18:20 Error handling: try/catch first
2:20:29 Exception propagation in coroutine hierarchies
2:22:42 SupervisorJob: error boundaries
2:25:01 Live demo: supervisorScope & async
2:29:41 Fixing the Articles app with a supervisor
2:31:58 CoroutineExceptionHandler
2:37:13 Exceptions in async & await
2:40:40 Error handling recommendations
2:42:09 Flows: beyond single values
2:44:27 Cold flows
2:49:54 Exercise: the Kettle temperature flow
2:54:59 Under the hood: Flow & FlowCollector
3:00:36 Exercise: progressive loading of articles
3:02:59 Concurrency inside flows: channelFlow
3:08:12 flow vs. channelFlow: which to pick
3:10:00 Hot flows
3:11:44 Live demo: a numbers station with MutableSharedFlow
3:17:10 SharedFlow replay
3:19:58 Exercise: chat broadcast with SharedFlow
3:23:23 shareIn: turning cold flows hot
3:24:52 Exercise: Fahrenheit in the Kettle app
3:28:38 StateFlow
3:32:58 stateIn & exercise: chat with priorities
3:36:11 Hot flows recap
3:37:25 Flow operators: intermediate vs. terminal
3:42:30 Exercise: writing a custom operator
3:45:36 Lifecycle & emission-control operators
3:48:22 Terminal operators
3:50:55 Error handling in flows: catch & retry
3:52:45 Exercise: retrying failed requests
3:55:14 Summary & goodbye










