Using Kotlin Coroutines for Asynchronous and Concurrent Programming
summary
Kotlin 1.3 uses suspend functions and coroutine builders to get sequential-looking code that suspends without blocking threads, demonstrated with Spring + Tomcat where 500 rps × 2s latency would otherwise mean ~1000 blocked threads (~1GB stack). Legacy futures are bridged via suspendCoroutine and lightweight async/await-style extension functions; structured cancellation is enforced by coroutine scope so request timeouts cancel child coroutines within milliseconds. Also shows mutexes, channels and confinement (single-coroutine ownership) for safe concurrency.
AI-written summary · about
chapters (11)
- 0:00Intro
- 2:50Why Asynchronous?
- 11:02Callbacks, Futures, Observables
- 13:10The challenge
- 17:24Kotlin Coroutines
- 30:54A Spring controller
- 38:33Coroutine Scope
- 39:43Parent-child coroutine relations
- 40:59What is a scope?
- 47:12How about concurrency?
- 58:34Resources
related talks
40mConcurrency made easy with Kotlin Coroutines
59mKotlin coroutines: new ways to do asynchronous programming
42mKotlin Coroutines: Beyond async/await
49mAsynchronous programming with Kotlin coroutines in Spring
43mCoroutines for Java Developers
49mKotlin Coroutines
47mKotlin Coroutines
46mIntroduction to Coroutines
