~/talk

When Atomics Lose - Architecture‑Dependent Performance of C++ Synchronization

Talkat C++Now 2026 · 2026-05-04..05-08· [concurrency, c-and-cpp]
links:none on file
slides:none on file

Benchmarks use C++ atomics and std::mutex on real hardware (MacBook M3 Pro and a 64‑core x86 server), running 400 threads, 100k iterations across five primitives: fetch_add vs compare_exchange in ARM (Apple Silicon M3 Pro) vs 64‑core x86. Result: on x86 atomics outperform mutexes consistently; on ARM atomics degrade badly under high contention — retry loops, cache‑line ping‑pong and LLSC/LSE behavior make compare_exchange and seq_cst atomics up to an order of magnitude slower, while mutexes win by blocking threads via futex wake/sleep. Slides and code are posted.

AI-written summary · about

  1. 0:00Atomic and mutex performance
  2. 1:04Atomic and mutex prevent races
  3. 2:09Locking under contention
  4. 4:46ARM vs x86 atomics
  5. 5:06Case study 400 threads
  6. 7:35Fetch add relaxed vs sequential consistency explained
  7. 12:13Live sync performance demo
  8. 16:53ARM high contention results
  9. 21:45x86 contention results
  10. 24:16ARM atomics under contention
  11. 26:49LLSC explained with analogy
  12. 29:16ABA problem in LLSC
  13. 30:41Cache line ping-pong impact
  14. 33:08TSO vs weak memory
  15. 35:19Weak memory atomic overhead
  16. 37:49Mutex vs atomics high contention
  17. 39:34Atomics or mutexes guidance
  18. 41:41Key takeaways architecture choices
  19. 42:24Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.