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.
C++20 coroutines have seemed very complex to me and I haven't sat down to try to understand them. I guess tiny_coro could help for that. I do remember that they were stackless.
I'm not that keen on coroutine and async approaches to concurrency anyway these days. I'd rather use something with actual multitasking, either with Posix threads or with lightweight processes like Erlang's or Go's.
Also, C++ itself is apparently in the process of sinking into a bog. Rust is taking over, which is not entirely good news. I had wanted to spend more time on Ada.
reply