Skip to content
← All Rust tracks

Async From First Principles

Rust

Build small futures and executors to understand polling, waking and pinning. Trace how asynchronous work makes progress without assuming a full runtime library.

This track uses Rust. You can make it your practice mode to browse related content across the site.

19 exercises

6 articles

Explore freely. Sign in to keep your progress.

Your learning sequence

  1. 1 Why async exists: blocking, threads, and the cost of waiting Read
  2. 2 Not solved yet. Create, drop and run futures Practice · Easy
  3. 3 Not solved yet. The Future trait: Output, Poll, and your first hand-written future Practice · Easy
  4. 4 Not solved yet. block_on: poll a future to completion Practice · Easy
  5. 5 Not solved yet. Countdown futures and the shape of Pending Practice · Easy
  6. 6 Waker and Context: the wakeup contract Read
  7. 7 Not solved yet. Queue another poll with Wake Practice · Medium
  8. 8 Not solved yet. RawWaker and RawWakerVTable: building a Waker with unsafe Practice · Hard
  9. 9 What async fn actually compiles to Read
  10. 10 Pin and Unpin: keeping a value at a stable address Read
  11. 11 Not solved yet. Unpin in practice: making Pin<&mut Self> usable without unsafe Practice · Medium
  12. 12 Not solved yet. Hand-compile an async fn into a state machine Practice · Hard
  13. 13 Not solved yet. poll_fn: a future from a closure Practice · Easy
  14. 14 Not solved yet. Join two futures and keep both results Practice · Medium
  15. 15 Not solved yet. Race two futures with a defined polling order Practice · Medium
  16. 16 Not solved yet. Structural pinning and safe pin projection by hand Practice · Hard
  17. 17 Not solved yet. The minimal single-threaded executor Practice · Hard
  18. 18 Not solved yet. Spawning, JoinHandle, and getting values back out Practice · Hard
  19. 19 Not solved yet. A logical-time reactor: timers without a clock Practice · Hard
  20. 20 Not solved yet. Fairness and starvation in your scheduler Practice · Medium
  21. 21 Not solved yet. Cancelling a future by dropping it Practice · Medium
  22. 22 Not solved yet. Cancel safety, blocking, and locks across .await Practice · Hard
  23. 23 Not solved yet. Async recursion, async closures, and streams Practice · Hard
  24. 24 How tokio and smol build on these primitives Read
  25. 25 Choosing between blocking and async code Read

Check yourself

4 questions · not saved while you're signed out

Use these questions to check your understanding and compare explanations. Your score does not affect track completion.

0 / 4 correct

What happens while handler executes its synchronous calculation during a poll?

Choose one answer to reveal the explanations. Answers are kept only while this page is open.

fn calculate() -> u64 {
    (0u64..1_000_000)
        .map(|n| std::hint::black_box(n) * n)
        .sum()
}

async fn handler() -> u64 {
    calculate()
}
Question 1 of 4