Figure 3-1.

A diagram showing happens-before relationships of the example code.

Four boxes are shown, corresponding to operations 1 through 4: store 10 to X, store 20 to Y, load from Y, load from X.

An arrow (representing a happens-before relationship) goes from box 1 (store 10 to X) to box 2 (store 20 to Y).

Another arrow goes from box 3 (load from Y) to box 4 (load from X).

Note that in the first case the store to X is first, while in the second case the load from Y, not X, is first.

There are no other arrows. So, there is no arrow that crosses the space between the threads.