Hardware Reference
In-Depth Information
Write
CPU A
1A
1B
1C
1D 1E
1F
CPU B
2A
2B
2C
2D
CPU C
3A
3B
3C
Synchronization point
Time
Figure 8-25.
Weakly consistent memory uses synchronization operations to di-
vide time into sequential epochs.
Release Consistency
Weak consistency has the problem that it is quite inefficient because it must
finish off all pending memory operations and hold all new ones until the current
ones are done.
Release consistency
improves matters by adopting a model akin to
critical sections (Gharachorloo et al., 1990). The idea behind this model is that
when a process exits a critical region it is not necessary to force all the writes to
complete immediately. It is only necessary to make sure that they are done before
any process enters that critical region again.
In this model, the synchronization operation offered by weak consistency is
split into two different operations. To read or write a shared data variable, a CPU
(i.e., its software) must first do an
acquire
operation on the synchronization vari-
able to get exclusive access to the shared data. Then the CPU can use them as it
wishes, reading and writing them at will. When it is done, the CPU does a
release
operation on the synchronization variable to indicate that it is finished. The
release
does not force pending writes to complete, but it itself does not complete
until all previously issued writes are done. Furthermore, new memory operations
are not prevented from starting immediately.
When the next
acquire
is issued, a check is made to see whether all previous
release
operations have completed. If not, the
acquire
is held up until they are all
done (and hence all the writes done before them are all completed). In this way, if
the next
acquire
occurs sufficiently long after the most recent
release
, it does not
have to wait before starting and the critical region can be entered without delay. If
it occurs too soon after a
release
, the
acquire
(and all the instructions following it)
will be delayed until all pending
release
s are completed, thus guaranteeing that the
variables in the critical section have been updated. This scheme is slightly more
complicated than weak consistency, but it has the significant advantage of not
delaying instructions as often in order to maintain consistency.