14.2.12.1.4 Ordering with Multiple CPUs on One Lock:

Suppose, instead of the two different locks as shown in Table [*], both CPUs acquire the same lock, as shown in Table [*]?


Table: Ordering With Multiple CPUs on One Lock
CPU 1 CPU 2
A = a; E = e;
LOCK M; LOCK M;
B = b; F = f;
C = c; G = g;
UNLOCK M; UNLOCK M;
D = d; H = h;


In this case, either CPU 1 acquires M before CPU 2 does, or vice versa. In the first case, the assignments to A, B, and C must precede those to F, G, and H. On the other hand, if CPU 2 acquires the lock first, then the assignments to E, F, and G must precede those to B, C, and D.

Paul E. McKenney 2011-12-16