I'm doing a project that is to implement a dual-processor system with some kind of cache coherency (for which I chose MESI) in VHDL. I just want to confirm this one thing: a write-hit on a shared cache line should cause the cache controller to send invalidation messages on the shared bus, and depending on the contention, it should stall the processor for some time, right?
I was thinking of this scenario; suppose a processor does something like this:
for (int i = 0; i < 5; ++i)
arr[i * 10] = 0; //just so each write is in a different cache line
If the array is entirely resident in the cache, and are is shared with other processors, each write will generate an invalidation message, each of which takes multiple cycles to complete; for the processor to continue execution, all these invalidation messages will have to be buffered, and the buffer wouldn't be bounded, so the write hit will have to stall the CPU for some time. Am I right about this?
EDIT: Care to explain the downvote? Which part of this question isn't clear? Or if you think it's an idiotic and terrible question, I assume you must have the answer for it then?