~/talk

C++ Coroutines at Scale - Implementation Choices at Google

Talkat C++Now 2024 · 2024-04-29..05-03· [concurrency, nodejs]
links:none on file
slides:none on file

Google runs C++ coroutines in production to process billions of RPCs/sec and the K3 library trades ergonomics for safety: a marker return type Co forces immediate await vs an opt‑in future that deep‑copies arguments to avoid dangling temporaries. Cancellation is mandatory — cancelled coroutines stop at next suspension and only run destructors — and the runtime never lets one coroutine resume another on the same thread, using a thread‑local queue to keep stack use bounded on 64KB stacks.

AI-written summary · about

  1. 0:00Introduction and overview
  2. 1:27Scale at Google and coroutines
  3. 4:13Use case for coroutines
  4. 5:36Basics of the coroutine library
  5. 8:23Lifetime rules for coroutine parameters
  6. 13:39Challenges with reference parameters
  7. 17:50Design choice for parameter lifetimes
  8. 21:01Future class for delayed awaiting
  9. 25:31Thread stack usage at Google
  10. 28:40Bounding stack usage with coroutines
  11. 32:28Resuming coroutines safely
  12. 37:29Event class and executor design
  13. 40:51Importance of cancellation support
  14. 42:40Cancellation design in the library
  15. 45:10Concurrency APIs and structured concurrency
  16. 52:31Unstructured concurrency and stack overflows
  17. 1:01:12Recap of design goals and trade-offs
  18. 1:04:40Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 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
?
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.