~/talk

Coroutines vs. Threads: The True Cost of a Context Switch

Talkat next.app devCon 2026 · 2026-10-07..10-09· [concurrency, kotlin]
slides:none on file

Explains OS and hardware costs of context switches down to syscalls, kernel traps, TCB bookkeeping and CPU cache invalidation, measures native memory with Android Studio Profiler, shows threads require 1–2MB thread stacks and repeatedly cause cache-thrashing, demonstrates the runtime launching 100,000 coroutines (small continuation objects of a few hundred bytes) while the same app crashes after a few hundred threads, and confirms coroutines run in user space so suspension avoids costly kernel context switches.

AI-written summary · about

  1. 0:00Introduction and agenda
  2. 1:45Thread fundamentals and overhead
  3. 6:22Context switches and cache misses
  4. 13:49Coroutine lightweight model
  5. 18:26Dispatchers and scheduling
  6. 20:18Live memory and performance demo
  7. 24:14Thread vs coroutine comparison
  8. 25:17Structured concurrency benefits
  9. 27:46Choosing the right dispatcher
  10. 31:39Main thread and UI responsiveness
  11. 32:42Real-world dispatcher examples
  12. 34:52User space advantages summary
  13. 36:17Q&A and closing
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.