Back to browse
GitHub Repository

A lightweight, educational M:N asynchronous runtime built from scratch with C++20 Coroutines. Features Work-Stealing, EBR, and Reactor-based I/O.

17 starsC++

Writing a C++20M:N Scheduler from Scratch (EBR, Work-Stealing)

by lixiasky·Feb 17, 2026·18 points·20 comments

AI Analysis

●●SolidBig BrainWizardryShip It

Strip-down coroutine runtime with work-stealing and EBR, readable in a weekend for learning.

Strengths
  • Minimal, readable core (~1k LOC) intentionally trades production features for learning clarity—honest positioning.
  • Manim animations (3Blue1Brown engine) visualizing task stealing and execution is exceptionally rare in systems education.
  • Real concurrency primitives (Chase-Lev deque, epoch-based reclamation) aren't hand-wavy—genuine lock-free structures.
Weaknesses
  • Educational project with no production use case—competes against Seastar, Folly only as a teaching tool, not a real runtime.
  • Linux/macOS only; no Windows support documented, limiting audience in some environments.
Target Audience

C++ systems programmers, educators, students learning concurrency and coroutine internals

Similar To

Folly · Seastar · Boost.Asio

Post Description

tiny_coro is a lightweight, educational M:N asynchronous runtime written from scratch using C++20 coroutines. It's designed to strip away the complexity of industrial libraries (like Seastar or Folly) to show the core mechanics clearly.

Key Technical Features:

M:N Scheduling: Maps M coroutines to N kernel threads (Work-Stealing via Chase-Lev deque).

Memory Safety: Implements EBR (Epoch-Based Reclamation) to manage memory safely in lock-free structures without GC.

Visualizations: I used Manim (the engine behind 3Blue1Brown) to create animations showing exactly how tasks are stolen and executed.

Why I built it: To bridge the gap between "using coroutines" and "understanding the runtime." The code is kept minimal (~1k LOC core) so it can be read in a weekend.

Similar Projects