How do Fibers Work? A Peek Under the Hood
summary
Explains an IO runtime implemented as a data type (pure, delay, flatMap) plus a single interpreter loop using an untyped call-stack of continuations, with async nodes implemented as callbacks and cooperative scheduling via JVM ExecutionContext and ScheduledExecutorService. Shows fibers as lightweight call‑stacks that yield by submitting the remaining callback to the thread pool, so many fibers run on a fixed small set of JVM threads non‑blocking. Demonstrates with an fs2-like server emitting pings 0..10 once per second and graceful shutdown after ten minutes.
AI-written summary · about
chapters (9)
- 0:00Fibers introduction
- 4:22Synchrony vs concurrency
- 15:41Concurrency on JVM/OS
- 24:52IO as data type
- 31:28Error handling in IO
- 40:20Async with continuations
- 48:53Fibers from threads/callbacks
- 53:13Fiber operations
- 58:11Why fibers simplify
related talks
40mFiber in the 10th year
42mHow to write synchronization mechanisms for Fiber
59mContinuations and Fibers: The New Frontier for Java
36mProject Loom
42mProject Loom Update
43mProject Loom: Fibers and Continuations for the Java Virtual Machine
29mUntangled: Sneak peek at Project Loom
20mSubprocesses, Threads and Fibers
