~/talk

A Relaxed Guide to memory_order_relaxed

Talkat CppCon 2020 · 2020-09-14..09-18· [concurrency]
links:none on file
links:none on file
slides:none on file

Explains that memory_order_relaxed permits simple load/store code and can be two orders of magnitude faster on weakly ordered CPUs like ARM, but the C++ model permits theoretical out-of-thin-air and RFUB behaviors that complicate static analysis. Gives a pragmatic catalog: safe cases (per-thread counters, single-shared flag, acquire on init / double-checked locking, compare_exchange retry paths), risky cases (speculation causing undefined behavior, lazy init that can write arbitrary addresses, reentrant-mutex tricks). Argues patterns work in practice though standards/compilers need years to catch up.

AI-written summary · about

  1. 0:00Intro
  2. 0:47Overview of the problem
  3. 3:35Outline of the problem
  4. 4:32C syntax
  5. 12:40Outlawing out of thin air
  6. 13:37C11 handwaving
  7. 16:01Out of thin air example
  8. 19:02Known good patterns
  9. 19:50When is it fully safe
  10. 20:37Use cases
  11. 22:35Unidirectional data flow
  12. 25:18What makes idioms unsafe
  13. 26:14Question
  14. 28:28Lazy initialization
  15. 31:05Reentry mutex
  16. 32:57Acquisition of mutex
  17. 37:20Other important examples
  18. 48:39Summary
  19. 49:53More Questions
  20. 54:35Memory Barriers
~/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.