the happens-before relation
Happens-before is the single most important relation in the whole memory model, and despite the name it is NOT about wall-clock time. It is a guarantee about VISIBILITY: if operation A happens-before operation B, then B is guaranteed to see A's effect (and everything A had already seen). If neither happens-before the other, they are 'concurrent' and the model gives you no promise about what one sees of the other.
It is built from two simpler pieces glued together. First, within a single thread, each statement is 'sequenced-before' the next in program order — that part is just ordinary single-thread order. Second, across threads, a release operation that is read by a matching acquire 'synchronizes-with' it. Happens-before is then the transitive closure: chain sequenced-before and synchronizes-with edges together, and wherever a path exists from A to B, A happens-before B. So 'A is sequenced-before a release, the release synchronizes-with an acquire, the acquire is sequenced-before B' gives you A happens-before B even though A and B are in different threads.
This is the rigorous replacement for the vague phrase 'this write should be visible by now'. The DRF guarantee is stated in terms of it: if every pair of conflicting accesses (where at least one writes) is ordered by happens-before, your program is data-race-free and behaves sequentially consistently. If two conflicting accesses are NOT ordered by happens-before, you have a data race, which is undefined behavior. Learning to draw the happens-before edges of your code is the core skill of concurrent reasoning.
T1: a = 42; store(&flag, 1, release); T2: if (load(&flag, acquire)==1) read a; edges: a=42 --sequenced-before--> release --synchronizes-with--> acquire --sequenced-before--> read a so a=42 happens-before read a, and read a is guaranteed to see 42.
Happens-before is a chain you assemble from sequenced-before (within a thread) and synchronizes-with (across threads).
Happens-before is a partial order, not a timeline: A may execute earlier in real time yet NOT happen-before B, in which case the model gives B no guarantee about A at all — 'it ran first' is not synchronization.