Consider the following code:
1 *A = a; 2 *B = b; 3 LOCK 4 *C = c; 5 *D = d; 6 UNLOCK 7 *E = e; 8 *F = f; |
This could legitimately execute in the following order, where pairs of operations on the same line indicate that the CPU executed those operations concurrently:
3 LOCK 1 *A = a; *F = f; 7 *E = e; 4 *C = c; *D = d; 2 *B = b; 6 UNLOCK |
Quick Quiz 14.13:
Given that operations grouped in curly braces are executed
concurrently, which of the rows of
Table
are legitimate reorderings of the assignments to variables
``A'' through ``F'' and the LOCK/UNLOCK operations?
(The order in the code is A, B, LOCK, C, D, UNLOCK, E, F.)
Why or why not?
End Quick Quiz
Paul E. McKenney 2011-12-16