From wikipedia https://en.wikipedia.org/wiki/Cache_coherence
Multiple copies of same data can exist in different cache simultaneously and if processors are allowed to update their own copies freely, an inconsistent view of memory can result.
What does this mean?
For example if you have
int myInt;
Does it mean that in a single core L1 cache can have multiple copies of myInt
? Thats not possible right? Because tag and index is checked to ensure uniqueness in l1 cache?
or does it mean that each level of cache have unique data, but l1 can have 1 copy of myInt
and l2 can have a separate copies of myInt
? If thats the case how does cache coherence work? which copy is more correct? does l1 cache sync with l2 cache and vice versa when dirty write happens?
or perhaps its referring to multi core
where each core can have a separate copy of myInt? in this case, how does cache coherence work in multicore environment?
4