问题
I'm wondering about MESI protocol implementation of writing with the allocation on write miss policy. Let's say that we have write request and got cache miss with no other copies of cache line. This diagram says that the next step is to fetch value from main memory (or L2 cache), store it and mark cache line as M (modified). I suppose then the new value is stored in cache block. The question is: Why we need the step of fetching data from main memory? Why we can't simply write the new value in to the first found cache line in I (invalid) state/replace the eldest cache line and mark it as M (modified)?
Thank you for your help!
回答1:
Assume you have 64-byte cache lines, and you write one byte. You can't put "1/64ths of a cache line" into the cache, so where do the remaining 63 bytes come from? They have to come from main memory (or the next level cache).
来源:https://stackoverflow.com/questions/39180919/mesi-protocol-write-with-cache-miss-why-needs-main-memory-value-fetch