Problem Set Solutions/Mulitprocessing/Problem08

A simple shared-memory cache-coherent machine has four processors, no virtual-to-physical translation and 16-bit (physical) addresses. There is one L1 data cache per processor and there is no L2 cache. Each L1 cache is direct-mapped with four 64-byte blocks (the size of each cache is 256 bytes), and they are kept coherent using the MESI coherence protocol. The initial state of each cache is as follows (tags are shown in hexadecimal notation):

table.jpg

What happens if the following memory access is executed next. In particular, specify whether the access is a cache hit or a miss, is there a write-back, is there a broadcast on the shared bus as a result of this access, what (if anything) happens in each of the other caches as a result of the bus broadcast, where the data comes from (if not already in the cache), and what the new state of the block is in the requestor’s cache and why. For each part of this problem, start with the state of the cache shown above, not with the state left by prior questions.

P3 writes a word to address 00FC

Solution:

Offset is 3C, set is 3, tag is 00. The line in set 3 is invalid, so this is a cache miss. The request for data (with intent to write) is broadcast on the bus. P0’s cache sees this request, and finds the requested block in its own set 3 in the M state. Therefore, P0’s cache has to respond with the data and invalidate its own copy of the line (state changes from M to I). P3’s cache gets the data, puts it in the line in set 3 (setting the tag to 00), and sets its state to M