Cache coherence definition
Cache coherence is used in shared memory multiprocessor systems to provide uniformity of the data that is stored across multiple local caches. Because each processor has its own cache memory, different caches could have different copies of the same memory block, which creates an inconsistency in the stored data. Namely, if one copy stored in one processor is changed or updated, all other copies must be changed or updated as well to avoid storing incoherent or outdated data. This is where cache coherence comes in, ensuring that all the changes or updates made for one copy are reflected in all other copies in a timely manner.
See also: memory cache, DNS cache
Types of cache coherence protocols in a multiprocessor system
- MSI (Modified, Shared, Invalid)
- MOSI (Modified, Owned, Shared, Invalid)
- MESI (Modified, Exclusive, Shared, Invalid)
- MOESI (Modified, Owned, Exclusive, Shared, Invalid)
Cache coherence mechanisms
- A directory-based system: Where the shared data is located in a common directory that upholds the coherence between different caches. When a data copy is changed, the directory can either update or invalidate the other caches with that change.
- Snooping: A process in which individual caches monitor address lines for access to memory locations that they have cached.
- Snarfing: A mechanism that involves a cache controller who monitors the access to memory locations that have been cached and oversees the actual data that is stored in the memory.