Implementing async with coroutines and fibers - project Loom in C#
summary
Reimplements C# async by replacing compiler-generated state machines with user-space scheduling: coroutines built from yield, fibers via WinAPI (ConvertThreadToFiber / SwitchToFiber called from C++/CLI), and a small queue pumping three fibers to interject a side job during a 2s Task.Delay. Introduces monad builders (id vs async) to swap scheduling at runtime and avoid statically bound Task/ValueTask allocation; proof‑of‑concept runs and demonstrates behavior, noting sync-primitive caveats and references 50 million concurrent connections as Loom’s motivating result.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 1:54Agenda overview
- 2:35Evolution of async patterns
- 6:19Understanding async/await
- 8:36Awaitable integer demo
- 10:36Async internals and threading
- 13:16Alternative async approaches
- 17:47OS threads vs green threads
- 21:17Green threads and coroutines
- 25:09Compiler-generated state machines
- 31:09Continuation passing style
- 35:41Fibers in Windows
- 39:27Re-implementing async with fibers
- 49:25Dynamic async configuration
- 56:47Conclusion
- 57:44Q&A session
related talks
42mProject Loom Update
53mFruits of the Loom – Lightweight Concurrency For the Java Platform
47mConcurrent and Asynchronous Programming: Loom in Java 20 and 21
35mUntangled: Sneak peek at Project Loom
01h 00mProject Loom? Better Futures? What’s next for JVM concurrent programming
29mUntangled: Sneak peek at Project Loom
43mProject Loom: Fibers and Continuations for the Java Virtual Machine
59mContinuations and Fibers: The New Frontier for Java
