Concurrency in Rust

Loading...
ProPart of the Pro catalogue.
6 decks30 cards

About this topic

This topic takes a problem-first approach to Rust concurrency. Instead of memorizing APIs in isolation, you'll reach for each tool — threads, channels, locks, atomics — precisely when a problem calls for it, and feel why Rust's type system makes data races a compile error rather than a runtime surprise.

You'll progress through six themed stages:

  1. Threads & Spawning — launch work on other threads, move data into them, join results back, and borrow local data safely with scoped threads.
  2. Message Passing — communicate between threads with mpsc channels, from a single round-trip to multi-producer fan-in.
  3. Shared State — share and mutate data across threads with Arc, Mutex, and RwLock, and understand lock poisoning.
  4. Atomics — count and signal without locks using atomic types, including a compare_exchange retry loop.
  5. Send & Sync — the two marker traits at the heart of Rust's thread safety: what they mean, why Rc isn't thread-safe, and how to make your own types shareable.
  6. Async Foundations — what async/.await really compile to, driven by a tiny hand-written executor so the Future trait stops being magic.

Every exercise is a small, focused problem with tests that verify your solution. By the end you'll think in terms of ownership and the Send/Sync boundary, and write concurrent Rust with confidence.

Decks