Let's build an async runtime together
summary
A small async runtime is built in Rust using only the standard library plus nix, implementing single-threaded with helper threads cooperative scheduling, per-task wakers and parking/unparking. It runs 1 million tasks sleeping concurrently in about 3–3.5s, implements sleep (currently spawns one background thread per sleep), nonblocking TCP connect and write via a background selector thread using select, and drives futures to completion. It sends data at scale in the demo — 7 GB at ~500 MB/s — but TCP read is missing and timers and FD polling should move to epoll/kqueue/io_uring for production.
AI-written summary · about
chapters (10)
- 0:00Building async runtimes
- 1:30What is async runtime
- 3:57First runtime with polling
- 6:07Async sleep
- 9:20Spawning tasks
- 13:50Efficient polling with wakers
- 18:28TCP connections and data
- 25:45Tasks and wakers
- 28:55Final demo
- 30:00Conclusion
related talks
29mAsychronous programming in Rust
18mA better way of doing Async Rust
02h 02mCloud Native Rust Workshop: Let's go parallel with Rust
20mIt's Critical: Concurrent programming as a sane programming model
26mReasoning with Async Rust
51mThe Need for Async
20mThe status of parallel rustc
30mAnatomy of a run-time: your contract with the kernel
