Lably
Skip to content

Cache coherence

Equivalence of all cached copies of a memory location

  • 7 min read
  • 4 chapters

Explore on Lably

ToursExplore Lably’s 3D tours

A cache coherence protocol is used to maintain cache coherency. The two main types are snooping and directory-based protocols.

Cache coherence is of particular relevance in multiprocessing systems, where each CPU may have its own local cache of a shared memory resource.

Overview

In a shared memory multiprocessor system with a separate cache memory for each processor, it is possible to have many copies of shared data: one copy in the main memory and one in the local cache of each processor that requested it. When one of the copies of data is changed, the other copies must reflect that change. Cache coherence is the discipline which ensures that the changes in the values of shared operands (data) are propagated throughout the system in a timely fashion.

The following are the requirements for cache coherence:

Write Propagation
Changes to the data in any cache must be propagated to other copies (of that cache line) in the peer caches.
Transaction Serialization
Reads/Writes to a single memory location must be seen by all processors in the same order.

Theoretically, coherence can be performed at the load/store granularity. However, in practice it is generally performed at the granularity of cache blocks.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication