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

Sign in to watch this lesson
The C++ Memory Model and Atomics · 4:29
How a release store keeps its promise through a chain of read-modify-writes, and how standalone fences order everything around them. We run Williams' work-queue example 100,000 times on an Apple M3 (in about 69,000 rounds one consumer synchronized through the release sequence alone, and all two million items were read correctly), compile fences to arm64 dmb ish / dmb ishld, and show in a litmus test that fences remove the bad outcome while a misplaced fence brings it back (once in sixty million runs here). Finally, atomics order plain non-atomic data, which is how mutexes work; ThreadSanitizer doesn't model standalone fences, and memory_order_consume should not be used.