Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 32s8 days 9 hours 54 minutes 32 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 32s8 days 9 hours 54 minutes 32 seconds.

Sign in to watch this lesson
The C++ Memory Model and Atomics · 4:11
The default memory order, and the strongest: every seq_cst operation from every thread sits on one timeline that all threads agree on. We work through the book's four-thread example (z can never be 0), then run the store-buffering litmus test ten million times on an Apple M3: seq_cst never let both threads read 0, release/acquire did 1.4 million times, and so did a version where only one thread used seq_cst. Finally, what it compiles to on arm64 (stlr/ldar), x86-64 (xchg for the store) and 32-bit ARM (dmb barriers), and what it cost in a timing loop.