Suppose we have the following situation: 2 CPU wtih write buffers and MESI is used as the cache coherence protocol. And we have one shared cache line between the CPUs:
CPU1 cache: |I|I|S|I|I|
CPU2 cache: |I|I|S|I|I|
Now CPU1 decides to modify the shared line. It puts the change record to its write buffer and sends invalidation message to CPU2. CPU2 receives it and sends an acknowledgment:
CPU1 cache: |I|I|S|I|I|
, CPU1 write buffer: change for the 3rd cache line
CPU2 cache: |I|I|I|I|I|
Is it right that on receiving the acknowledgment CPU1 doesn't have to flush the write buffer and change the cache line state to M(modified)? If not than let's go further.
Suppose now CPU2 wants to read this cache line again. Should snooping CPU1 intercept this read request, and flush buffer->flush cache line->send the last value of the cache line to CPU2
? Or it might ignore it and CPU2 would still have the old value by asking the RAM(which wasn't changed yet)?