indicogniBuild a VMM

Lab

Litmus

Used in chapter 16, the memory-ordering primer.

Step two threads through a machine with visible store buffers, list every outcome arm64, x86-64 and the paper model allow, and tell a lucky zero from a guaranteed one.

Runs in browser
The store-buffering test with both stores still queued Thread A runs X.store(1) and Thread B runs Y.store(1), but each store waits in its own core's store buffer. Then A loads Y and B loads X straight from shared memory, where both are still 0, so both threads read 0. Interleaving on paper can never give that outcome; arm64 and x86-64 both allow it, and only a fence(SeqCst) between the store and the load in both threads forbids it. Thread A X.store(1) r1 = Y.load() → 0 Thread B Y.store(1) r2 = X.load() → 0 buffer: X = 1 (queued) buffer: Y = 1 (queued) shared memory: X = 0, Y = 0 both loads read here: r1 = 0, r2 = 0

All labs