Skip to content
Related Articles
Open in App
Not now

Related Articles

Difference between Cache Coherence and Memory Consistency

Improve Article
Save Article
Like Article
  • Last Updated : 15 Sep, 2022
Improve Article
Save Article
Like Article

1. Cache coherence :
Cache coherence in computer architecture refers to the consistency of shared resource data that is stored in multiple local caches. When clients in a system maintain caches of a shared memory resource, problems with incoherent data can arise, which is especially true for CPUs in a multiprocessing system.
In a shared memory multiprocessor with a separate cache memory for each processor, any one instruction operand can have multiple copies: one in main memory and one in each cache memory. When one copy of an operand is modified, the other copies must be modified as well. Cache coherence is the discipline that ensures that changes in the values of shared operands are propagated throughout the system in a timely manner.

2. Memory consistency :
Memory consistency defines the order in which memory operations (from any process) appear to execute with respect to one another.
What orders are kept?
Given a load, what are the possible values it can return?
It is impossible to tell much about the execution of an SAS (Statistical Analysis System) programmed without it. Consequences for both programmers and system designers.
A programmed is used by a programmer to reason about correctness and possible outcomes.
System designers can use this to limit the number of accesses that can be reordered by the compiler or hardware.
Agreement between the programmer and the system.

Difference between Cache Coherence and Memory Consistency :

Sr. No. Cache coherence Memory consistency
1. Cache Coherence describes the behavior of reads and writes to the same memory location. Memory consistency describes the behavior of reads and writes in relation to other locations.
2. Cache coherence required for cache-equipped systems. Memory consistency required in systems that have or do not have caches.
3. Coherence is the guarantee that caches will never affect the observable functionality of a program

Consistency is the specification of correctness for memory accesses, 

Defining guarantees on when loads and stores will happen and when they will be seen by the different cores

4. It is concerned with the ordering of writes to a single memory location. It handles the ordering of reads and writes to all memory locations

A memory system is coherent if and only if

– Can serialize all operations to that location 

– Read returns the value written to that location by the last store.

Consistency is a feature of a memory system if

– It adheres to the rules of its Memory Model.

– Memory operations are performed in a specific order.


My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!