typeover
rust curriculum

Curriculum Production Rust Threads and channels exercise 1 · mcq

Threads and channels

A spawned thread needs to OWN its captured data — the parent scope may end before the thread finishes. Pick the closure modifier.

TypeScript reference
Pick the idiomatic Go translation

About this theme

Rust's ownership rules extend into concurrency. This theme covers thread::spawn, move closures, JoinHandle, message passing with channels, and shared state with Arc<Mutex<T>>. Planned exercises: 1. choose move for spawned threads. 2. recognise join. 3. choose a channel for message passing. 4. fill thread::spawn. 5. fill Arc::clone. 6. write a thread that returns a value. 7. write a channel sender and receiver. 8. translate TS async-looking work into threaded Rust. 9. fix shared mutable state with Arc<Mutex<_>>.