has a modified copy of the line. The initiating processor surrenders the bus and
waits. The other processor gains access to the bus, writes the modified cache line
back to main memory, and transitions the state of the cache line to invalid (because
the initiating processor is going to modify this line). Subsequently, the initiating
processor will again issue a signal to the bus of RWITM and then read the line
from main memory, modify the line in the cache, and mark the line in the modified
state.
The second scenario is that no other cache has a modified copy of the requested
line. In this case, no signal is returned, and the initiating processor proceeds to read in
the line and modify it. Meanwhile, if one or more caches have a clean copy of the line
in the shared state, each cache invalidates its copy of the line, and if one cache has a
clean copy of the line in the exclusive state, it invalidates its copy of the line.
WRITE HIT When a write hit occurs on a line currently in the local cache, the effect
depends on the current state of that line in the local cache:
• Shared: Before performing the update, the processor must gain exclusive ownership
of the line. The processor signals its intent on the bus. Each processor
that has a shared copy of the line in its cache transitions the sector from shared
to invalid.The initiating processor then performs the update and transitions its
copy of the line from shared to modified.
• Exclusive: The processor already has exclusive control of this line, and so it
simply performs the update and transitions its copy of the line from exclusive
to modified.
• Modified: The processor already has exclusive control of this line and has the
line marked as modified, and so it simply performs the update.
L1-L2 CACHE CONSISTENCYWe have so far described cache coherency protocols
in terms of the cooperate activity among caches connected to the same bus or other
SMP interconnection facility.Typically, these caches are L2 caches, and each processor
also has an L1 cache that does not connect directly to the bus and that therefore
cannot engage in a snoopy protocol.Thus, some scheme is needed to maintain data
integrity across both levels of cache and across all caches in the SMP configuration.
The strategy is to extend the MESI protocol (or any cache coherence protocol)
to the L1 caches. Thus, each line in the L1 cache includes bits to indicate the
state. In essence, the objective is the following: for any line that is present in both an
L2 cache and its corresponding L1 cache, the L1 line state should track the state of
the L2 line. A simple means of doing this is to adopt the write-through policy in the
L1 cache; in this case the write through is to the L2 cache and not to the memory.
The L1 write-through policy forces any modification to an L1 line out to the L2
cache and therefore makes it visible to other L2 caches. The use of the L1 writethrough
policy requires that the L1 content must be a subset of the L2 content.This
in turn suggests that the associativity of the L2 cache should be equal to or greater
than that of the L1 associativity. The L1 write-through policy is used in the IBM
S/390 SMP.
If the L1 cache has a write-back policy, the relationship between the two caches
is more complex.There are several approaches to maintaining coherence. For example,
the approach used on the Pentium II is described in detail in [SHAN05]