Rust Atomics in the Wild: Memory Ordering Design Patterns [...]
Talkat RustConf 2026 · on Thursday, 2026-09-10· at 11:50· Room 511 | Palais des Congrès de Montréal, Palais des Congrès de Montréal·
summary
Covers concrete Rust patterns and failures: a futex implemented with an AtomicU32 uses acquire-release for lock/unlock and release+fence to guarantee safe drop; Arc clone/drop uses fetch_add/fetch_sub with relaxed for increments and a fence to synchronize destruction; bounded MPMC channel packs head/tail into one atomic and uses probe-validate-execute (relaxed probe, acquire validate, RMW reserve) with seq‑cons fences in Rayon to prove the “producer misses sleeper” outcome is impossible. Tests must target x86 and ARM due to differing hardware orderings.
AI-written summary · about
chapters (8)
- 0:00Introduction and background
- 1:53Rust atomics basics
- 6:07Happens-before relationships
- 8:53Acquire and release patterns
- 10:28Real-world examples
- 16:04Probe validate execute
- 19:06Sequential consistency
- 29:15Q&A on memory ordering
related talks
01h 03mUsing weakly ordered C++ atomics correctly
01h 28mAtomic’s memory orders, what for?
01h 01m“C++11/14/17 atomics and memory model..."
33mAtomic break down: understanding ordering
45mRust: safe and concurrent. But how does it do it?
40mRust’s approach of getting things right
01h 03mSafety: off --- How not to shoot yourself in the foot with C++ atomics
43mC++ Atomics...
