While studying the MSI protocol as described in different sources such as:
they say that when moving from Modified to Invalid due to a BusRdX (another cache wants to write to the line), that the cache must write back to memory, or a "Flush" in the Wikipedia terminology.
However, I don't understand why this is needed. Wouldn't it be more efficient instead to:
not do anything immediately
service future reads from the new Modified cache.
This new Modified cache must exist, because the only way for a cache to move from Modified to Invalid (besides eviction) is with a BusRdX, and the only thing that produces a BusRdX is another cache going to Modified after PrWr.
More verbosely, the cache of the new writing CPU must first request that line to be read from the old modified cache, and this request both invalidates the old cache, and makes the most up to date value be in the new modified cache that was written to.
only Flush on eviction, when the Modified cache is full and needs to offload something into main memory
If this approach is wrong, could anyone provide an example of how it would lead to a data loss problem? Or is there another more external reason why this Flush is needed?
This question somewhat supposes that cache-to-cache transfers are possible, which I'm not entirely sure. Here is a video that discusses that: Cache To Cache Transfers - Georgia Tech - HPCA: Part 5.