14.2.12.1.3 Ordering with Multiple Locks:

Code containing multiple locks still sees ordering constraints from those locks, but one must be careful to keep track of which lock is which. For example, consider the code shown in Table [*], which uses a pair of locks named ``M'' and ``Q''.


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


In this example, there are no guarantees as to what order the assignments to variables ``A'' through ``H'' will appear in, other than the constraints imposed by the locks themselves, as described in the previous section.

Quick Quiz 14.14: What are the constraints for Table [*]? End Quick Quiz

Paul E. McKenney 2011-12-16