In symmetric multi-processor (SMP) systems the caches of the CPUs cannot work independently from each other.
All processors are supposed to see the same memory content at all times.
The maintenance of this uniform view of memory is called "cache coherency".
If a processor were to look simply at its own caches and main memory it would not see the content of dirty cache lines in other processors.
Providing direct access to the caches of one processor from another processor would be terribly expensive and a huge bottleneck.
Instead, processors detect when another processor wants to read or write to a certain cache line.
在对称多处理器系统中,CPU caches不能独立的工作。
在任何时候,所有的处理器都应该看到相同的内容。
这种统一的内存视图维护被称为“cache一致性”。
如果一个处理器能够简单的看到它自己的caches和主内存,它不能看到其它处理器上的脏高速缓冲行内容。
提供从一个处理器直接访问另一个高速缓冲的机制,将十分的昂贵而且有巨大的技术瓶颈。
为了解决上面的问题,当另一个处理器想要读或者写一个指定的高速缓冲行的时候,处理器会去检测这个行为。
If a write access is detected and the processor has a clean copy of the cache line in its cache, this cache line is marked invalid.
Future references will require the cache line to be reloaded.
Note that a read access on another CPU does not necessitate an invalidation, multiple clean copies can very well be kept around.
如果处理器检测到一个写的访问,处理器的cache中有一个干净的高速缓冲行副本,这个高速缓冲行副本将被标记为无效。
以后需要重新加载高速缓冲行。
注意:在另一个cpu有一个读访问不需要标记为无效的高速缓冲行副本,多个干净的副本可以很好地保持。
More sophisticated cache implementations allow another possibility to happen.
Assume a cache line is dirty in one processor's cache and a second processor wants to read or write that cache line.
In this case the main memory is out-of-date and the requesting processor must, instead, get the cache line content from the first processor.
Through snooping, the first processor notices this situation and automatically sends the requesting processor the data.
This action bypasses main memory, though in some implementations the memory controller is supposed to notice this direct transfer and store the updated cache line content in main memory.
If the access is for writing the first processor then invalidates its copy of the local cache line.
更加复杂的缓存实现允许另一种可能性发生。
假设一个处理器cache中一个高速缓冲行是脏的并且第二个处理器想要读或者写这个脏的高速缓冲行。
在这种情形下,主内存是过时的并且请求处理器(第二个处理器)必须从第一个处理器中获取到高速缓冲行的内容。
通过窥探,第一个处理器注意到这种情形并且自动的发送对应的高速缓冲行数据给请求处理器。
这个动作是绕过主存储器的,通过一些实施方式,内存控制器能够做到注意到这个直接传输的动作并且保存更新的高速缓冲行内容在主存储中。
如果对一个处理器的高速缓冲进行写访问,导致本地高速缓冲行副本无效。
阅读(1160) | 评论(0) | 转发(0) |