October 9th 2024
Async Rust is a very powerful abstraction for concurrent systems.
It is being used extensively in web development for its ability to handle many thousands of concurrent requests at a time. As an abstraction, though, async Rust is quite a brittle one. Many of its footguns and complications often need to be learned the hard way.
In this workshop, we will be practising the hard way—you will redesign async Rust from the ground up. The outcome of this exercise will give you a much better understanding of the abstractions you use on a daily basis, learn the exact reasons behind some of the quirks, and develop your own workarounds for such problems. It will also teach you how to build your own inter-task concurrency mechanisms and even your own specialised async runtimes, should you need it.
Syllabus
-
Morning
- Getting started, ensuring that rustc is setup correctly.
- Introducing the Future trait.
- Writing a simple future state machine.
- Writing a simple async channel.
- Writing a simple async mutex.
-
Afternoon
- Writing a simple pollster executor.
- Introducing a spawn method to the executor
- Introducing a timer system to build out the runtime.
Requirements
Equipment
- A working laptop:
- Running a modern OS (with Tier 1 or Tier 2 "with Host Tools" support for rustc)
- Windows 10+
- Linux 3.2+ (preferably 5.0+)
- macOS 10.12+ (preferably 12.0+)
- With an up-to-date rust toolchain (Either use rustup or ensure you have the latest stable compiler)
Before coming to the session, clone the tokio repository and try run the examples. (https://github.com/tokio-rs/tokio/blob/master/examples/echo.rs)
Knowledge
- Attendees should already be comfortable using Rust.
- Must be comfortable with rust memory management and the borrow checker.
- Must be comfortable with traits.
- Good to know some knowledge of Sync concepts.
- Good to be comfortable with writing some async Rust.
- Attendees do not need to be experts of Rust
- Do not need to be comfortable using unsafe or the Rust memory models.
- Do not need to understand how the synchronisation primitives (Mutex, Channel) are implemented.
- Do not need to know how to use async kernel APIs like epoll or kqueue.
Workshop Venue
The place to learn
The EuroRust workshops will take place in WEXELERATE, located at Praterstrasse 1, 1020 Vienna, Austria.