The MESI Protocol

Source: Internet
Author: User

Computer ORGANIZATION and ARCHITECTURE designing for performance ninth EDITION

To provide cache consistency in an SMP, the data cache often supports a protocol
Known as MESI. For MESI, the data cache includes both status bits per tag, so
Each line can is in one of the four states:

? Modified:the line in the cache have been Modified (different from main
Memory) and is available only in this cache.
? Exclusive:the line in the cache is the same as, in main memory and are not
Present in any other cache.
? Shared:the line in the cache is the same as, in main memory and May
Present in another cache.
? Invalid:the line in the cache does not contain valid data.

Table 17.1 summarizes the meaning of the four states. Figure 17.6 displays a
State diagram for the MESI protocol. Keep in mind, all line of the cache have
Its own state bits and therefore it own realization of the state diagram. Figure 17.6a
Shows the transitions that occur due to actions initiated by the processor attached
to the cache. Figure 17.6b shows the transitions so occur due to events that is
snooped on the common bus. This presentation of separate state diagrams for proces-
Sor-initiated and bus-initiated actions helps to clarify the logic of the MESI protocol.

At any time a, cache line was in a single state. If the next event is from the attached
processor, then the transition was dictated by figure 17.6a and if the next event is
From the bus, the transition are dictated by figure 17.6b. Let us look at these transi-
tions in more detail.

READ

MISS when a read MISS occurs in the local cache, the processor initiates a
Memory read to read the line of main memory containing the missing address. The
Processor inserts a signal on the bus it alerts all other Processor/cache units to
Snoop the transaction. There is a number of possible outcomes:
? If One other cache have a clean (unmodified since read from memory) copy of
The exclusive state, it returns a signal indicating that it shares this
Line. The responding processor then transitions the state of their copy from ex-
Clusive to GKFX, and the initiating processor reads the line from main mem-
Ory and transitions the line in their cache from invalid to GKFX.
? If One or more caches has a clean copy of the.
them signals that it shares the line. The initiating processor reads the line and
Transitions the line in its cache from invalid to GKFX.
? If One other caches have a modified copy of the line and then that cache blocks the
Memory Read and provides the line to the requesting cache over the shared
Bus. The responding cache then changes it line from modified to GKFX.
1
The
Line sent to the requesting cache are also received and processed by the memory
Controller, which stores the block in memory.
? If No other caches have a copy of the line (clean or modified) and then no signals is
Returned. The initiating processor reads the line and transitions the
Cache from invalid to exclusive.
READ

Hit when a read hits occurs on a line currently in the local cache, the
Processor simply reads the required item. There is no State change:the state
Remains modified, GKFX, or exclusive.
WRITE

MISS when a write MISS occurs in the local cache, the processor initiates a
Memory read to read the line of main memory containing the missing address. For
This purpose, the processor issues a signal on the bus that means read-with-intent-
To-modify (RWITM). When the line was loaded, it is immediately marked modified.
With respect to other caches, both possible scenarios precede the loading of the line
of data.
First, some other caches may has a modified copy of this line (state = modify).
In this case, the alerted processor signals the initiating processor that another proc-
Essor 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-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 would 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
Modified state.
The second scenario is and no other cache have a modified copy of the requested
Line. In this case, no signal are returned, and the initiating processor proceeds to read
In the line and modify it. Meanwhile, if one or more caches has a clean copy of the
Line in the shared state, each cache invalidates its copy of the line, and if one cache
Have a clean copy of the exclusive state, it invalidates it copy of the line.
WRITE

Hit when a write hits occurs on a line currently in the local cache, the effect
Depends on the current state of the the the The local cache:
? Shared:before performing the update, the processor must gain exclusive own-
Ership of the line. The processor signals its intent on the bus. Each processor
that have a shared copy of the line in their cache transitions the sector from GKFX
to invalid. The initiating processor then performs the update and transitions
Its copy of the line from GKFX to modified.
? Exclusive:the processor already have 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 the
Line marked as modified, and so it simply performs the update.
L1-l2
CACHE

Consistency We 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 is L2 caches, and each
Processor also has a L1 cache that does does 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 proto-
COL) to the L1 caches. Thus, each of the L1 cache includes bits to indicate the
State. In essence, the objective are the following:for any line that's present in both an
L2 cache and its corresponding L1 caches, the L1 line State should
The L2 line. A simple means of doing the "to adopt" the Write-through policy in the
L1 Cache; In this case the write through are to the L2 cache and the memory.
The L1 write-through policy forces any modification to a L1 line out to the L2
Cache and therefore makes it visible to other L2 caches. The use of the L1 write-
Through policy requires that the L1 content must be a subset of the content of the L2. This
In turn suggests that the associativity of the L2 cache should is equal to or greater
than that's 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 caches
is more complex. There is several approaches to maintaining coherence. For
example, the approach used on the Pentium II was described in detail in [SHAN05].

The MESI Protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.