
696 CHAPTER 9 Hardware/Software Trade-Offs
A = 1;
| po
B = 1;
| po
flag = 1; -
.
CO
.. =
flag;
\
1 po | P
2
spinning on flag
... =
flag;
/
1 po /
' " I po*
9
'' ^>
?2 finally reads flag = 1
u = A;
j po
V = B;
FIGURE 9.7 An example code sequence illustrating program and conflict orders.
The arcs labeled "po" show program order, and the one labeled "co" shows conflict order.
Notice that between the write to A by
P^
and the read to A by P
2
is a chain of accesses
formed by program order and conflict order arcs. This will be true in all SC executions of
the program. Such chains that have at least one program order arc imply that the accesses
are noncompeting ...