0
votes

To quote Henessey and Patterson, "The other key aspect of writes is what occurs on a write miss. We first fetch the words of the block from memory. After the block is fetched and placed into the cache, we can overwrite the word that caused the miss into the cache block. We also write the word to main memory using the full address."

I don't seem to comprehend the above statement. If we're overwriting the word in the cache, it means that previously, the index of the address was matching, but the tag value was different. So, the processor stalls and orders to read from the memory and write into the cache. This will obviously replace the previous contents of the block (Take 1 block contains 1 word). Then why do we write the word again into the memory? Didn't we just fetch it from there?

Can someone elaborate on the previous statement specifically, and on write-miss in general? What does write-miss mean?

1

1 Answers

2
votes

Write-miss is similar to a read miss (the entry you are looking for is not in the cache), except the operation is a write. When a write miss happens we can do few things. One is to treat the miss as a read miss, which we call fetch-on-write, fetch data and modify the word that needs updating. You've mentioned that there is no point of fetching data from memory if they are going to be modified. This is true, but a cache line is comprised on multiple words, therefore fetching the whole cache-line is beneficial, if the subsequent operation is a read and it is destined to one of the words of the fetched cache line. I believe the main benefit is the ease of the design. If you follow the path of write-allocate where a fresh cache line is allocated for the missed entry and the new data is stored. Now we have to be careful, because if the cache-line is comprised of multiple words, say 4, only one word has the proper data and all others are garbage. This require to maintain per word mask in the cache-line indicating which word is valid and which in not valid.

Here is a good article by Norman P. Jouppi on writre miss policies. http://dl.acm.org/citation.cfm?id=165154