Rust Atomics and Locks
Mara Bos's book on low-level concurrency in Rust, free to read online and published in print by O'Reilly. Atomics, memory ordering, mutexes, condition variables and channels, built from scratch so you understand what Arc and Mutex do for you.
250 pages
mara.nl · Sept 2026
January 2023
mara.nl · Sept 2026
Book
Other
Mara Bos (O'Reilly)
3 to 5 weeks
Advanced
Free
What the book is
Rust Atomics and Locks: Low-Level Concurrency in Practice is by Mara Bos, former team lead of the Rust library team. The full text is free to read on her website, and O'Reilly publishes the printed and ebook versions (released January 2023, about 250 pages). Translations exist in Japanese, Korean, Russian and Chinese.
What it covers
The book explains how concurrency works underneath the types you already use. It covers threads and shared ownership, atomics and what they guarantee, memory ordering and why it matters, and how processors execute concurrent code. Then it builds real primitives from scratch: a spin lock, channels, your own Arc, and locks such as a mutex, a condition variable and a reader-writer lock, using the operating system's primitives where they are needed.
Why a backend developer should read it
Most of the time an Axum service only needs Arc, Mutex and channels. But under load, questions appear: why a lock is contended, when an atomic counter is enough, why a design deadlocks, or why an in-memory cache behaves differently on another machine. This book gives you the model to answer them. It also makes the Send and Sync errors from the compiler feel logical rather than arbitrary.
Is it worth it?
It is a deeper read, not a starting point. Read it after you have built and deployed a service and want to understand concurrency properly, or if you plan to work on databases, proxies, runtimes or other infrastructure written in Rust.
How long it takes
About three to five weeks at a chapter or two a week, running and changing the code as you go. The memory ordering chapters need a second reading for most people.
Prerequisites
Solid Rust, including traits, generics and some familiarity with unsafe, plus basic experience with threads in any language.
Free or paid?
Free to read online on the author's site. The print and ebook editions from O'Reilly are paid.
What you can do after it
Choose between atomics and locks with confidence, reason about memory ordering, read the source of concurrency crates, and debug contention and deadlocks in a real service.
Common questions
Do I need this to write async code? No. The Tokio tutorial covers what async services need day to day; this book goes one level deeper.
Is it only about Rust? The ideas about atomics, memory ordering and locks apply to any language, and Rust is the clearest way to see them.
Ready to start?
Opens on Mara Bos (O'Reilly) in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.