October 9th 2024

Rediscovering the Future: a deep dive into async Rust

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.

Get your ticket

Syllabus

  1. Morning

    1. Getting started, ensuring that rustc is setup correctly.
    2. Introducing the Future trait.
    3. Writing a simple future state machine.
    4. Writing a simple async channel.
    5. Writing a simple async mutex.

  2. Afternoon

    1. Writing a simple pollster executor.
    2. Introducing a spawn method to the executor
    3. Introducing a timer system to build out the runtime.

Requirements

  1. Equipment

      A working laptop:
    1. Running a modern OS (with Tier 1 or Tier 2 "with Host Tools" support for rustc)
    2. Windows 10+
    3. Linux 3.2+ (preferably 5.0+)
    4. macOS 10.12+ (preferably 12.0+)
    5. 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)

  2. Knowledge

      Attendees should already be comfortable using Rust.
    1. Must be comfortable with rust memory management and the borrow checker.
    2. Must be comfortable with traits.
    3. Good to know some knowledge of Sync concepts.
    4. Good to be comfortable with writing some async Rust.
      Attendees do not need to be experts of Rust
    1. Do not need to be comfortable using unsafe or the Rust memory models.
    2. Do not need to understand how the synchronisation primitives (Mutex, Channel) are implemented.
    3. Do not need to know how to use async kernel APIs like epoll or kqueue.

Mentor

Conrad Ludgate

Conrad Ludgate is a Systems Software Engineer at Neon building database proxies for their serverless Postgres platform by day. By night, he is highly focused on experimenting with all things low-latency Rust. Over the past couple of years, that focus has been extensively directed at async Rust. Known as 'that async rust guy' with his peers, he has given several talks and technical deep dives under the hood into async Rust.

Conrad Ludgate
venue picture
Workshop Venue

The place to learn

The EuroRust workshops will take place in a separate venue in the city center – details to be announced soon.