Skip to content

Shared memory

The result this checker says is impossible

Two threads, four lines, and an outcome no interleaving produces — which real hardware produces anyway.

12 minutes · sequential consistency · store buffering · litmus tests

What this engine has been assuming

Everything so far has rested on an assumption so natural it is easy to miss: that a program's execution is *some interleaving of its operations*. Thread A does one of its steps, then thread B does one of its steps, and the result is whatever that sequence produces. That model is called sequential consistency, and the checker in this app implements it exactly.

It is also not what your computer does. A processor buffers its writes and lets its own later reads overtake them; a compiler reorders independent statements freely. Both are allowed to, precisely because the accesses were unsynchronised — and neither of those behaviours is an interleaving of anything.

Everything you do here stays in this browser.