We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Async From First Principles
RustBuild 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.
Your learning sequence
- 1 Why async exists: blocking, threads, and the cost of waiting Read
- 2 Not solved yet. Create, drop and run futures Practice · Easy
-
3
Not solved yet.
The
Futuretrait:Output,Poll, and your first hand-written future Practice · Easy -
4
Not solved yet.
block_on: poll a future to completion Practice · Easy -
5
Not solved yet.
Countdown futures and the shape of
PendingPractice · Easy -
6
WakerandContext: the wakeup contract Read - 7 Not solved yet. Queue another poll with Wake Practice · Medium
-
8
Not solved yet.
RawWakerandRawWakerVTable: building aWakerwith unsafe Practice · Hard -
9
What
async fnactually compiles to Read - 10 Pin and Unpin: keeping a value at a stable address Read
-
11
Not solved yet.
Unpinin practice: makingPin<&mut Self>usable without unsafe Practice · Medium -
12
Not solved yet.
Hand-compile an
async fninto a state machine Practice · Hard -
13
Not solved yet.
poll_fn: a future from a closure Practice · Easy - 14 Not solved yet. Join two futures and keep both results Practice · Medium
- 15 Not solved yet. Race two futures with a defined polling order Practice · Medium
- 16 Not solved yet. Structural pinning and safe pin projection by hand Practice · Hard
- 17 Not solved yet. The minimal single-threaded executor Practice · Hard
-
18
Not solved yet.
Spawning,
JoinHandle, and getting values back out Practice · Hard - 19 Not solved yet. A logical-time reactor: timers without a clock Practice · Hard
- 20 Not solved yet. Fairness and starvation in your scheduler Practice · Medium
- 21 Not solved yet. Cancelling a future by dropping it Practice · Medium
-
22
Not solved yet.
Cancel safety, blocking, and locks across
.awaitPractice · Hard - 23 Not solved yet. Async recursion, async closures, and streams Practice · Hard
- 24 How tokio and smol build on these primitives Read
- 25 Choosing between blocking and async code Read
Check yourself
4 questions · not saved while you're signed outUse these questions to check your understanding and compare explanations. Your score does not affect track completion.
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()
}