Skip to content

Memory coherence

1、"coherence"的意思是"一致性"。

2、讲得其实就是cache coherence

Wikipedia Memory coherence

Memory coherence is an issue that affects the design of computer systems in which two or more processors or cores share a common area of memory.[1][2][3][4]

NOTE: 从one(uniprocessor) to many( multiprocessor (or multicore) ),复杂度提升了非常多,因此需要相应的理论来对这种情况进行说明。

In a uniprocessor system (whereby, in today's terms, there exists only one core), there is only one processing element doing all the work and therefore only one processing element that can read or write from/to a given memory location. As a result, when a value is changed, all subsequent read operations of the corresponding memory location will see the updated value, even if it is cached.

NOTE: uniprocessor 是非常简单的;

Conversely, in multiprocessor (or multicore) systems, there are two or more processing elements(对应的是multiple model中的entity) working at the same time, and so it is possible that they simultaneously access the same memory location. Provided none of them changes the data in this location, they can share it indefinitely and cache it as they please. But as soon as one updates the location, the others might work on an out-of-date copy that, e.g., resides in their local cache. Consequently, some scheme is required to notify all the processing elements of changes to shared values; such a scheme is known as a "memory coherence protocol", and if such a protocol is employed the system is said to have a "coherent memory".

NOTE: 使用multiple model进行描述。

The exact nature and meaning of the memory coherency is determined by the consistency model that the coherence protocol implements. In order to write correct concurrent programs, programmers must be aware of the exact consistency model that is employed by their systems.

NOTE: 可以使用consistency model来描述这种问题

When implemented in hardware, the coherency protocol can, e.g., be directory based or employ snooping (a.k.a. "sniffing"). Examples of specific protocols are the MSI protocol and its derivatives MESI, MOSI and MOESI.