Cache Coherence ?

Omar Faroque
CS Beauty
Published in
2 min readAug 27, 2023

--

| I watched lots of lectures and videos about cache coherence but I did not find any specific doc that explains it well. So I tried to collect it into a single doc to cover it.

In computer architecture, cache coherence is the uniformity of shared resource data that ends up stored in multiple local caches. — Wikipedia

In a multiprocessor environment, all the processors in the system share the main memory via a bus. Now, keeping a common cache for all the processors will enhance the size of the cache thereby slowing down the performance of the system.

For better performance, each processor implements its own cache. Processors may share the same data block by keeping a copy of this data block in their cache. The figure below shows how processors P1, P3 & Pn have the copy of shared data block X of main memory in their caches.

In case, the processor P1 modifies the copy of shared memory block X present in its cache. It would result in data inconsistency. As the processor P1 will have the modified copy of the shared memory block i.e. X1. But, the main memory and other processors’ cache will have the old copy of the shared memory block X. And this problem is the cache coherence problem.

The figure below shows the cache coherence problem in a multiprocessing environment.

--

--