1.缓存一致性:
计算机体系结构中的缓存一致性是指存储在多个本地缓存中的共享资源数据的一致性。当系统中的客户端维护共享内存资源的缓存时,可能会出现数据不一致的问题,这对于多处理系统中的 CPU 尤其如此。
在每个处理器都有一个单独的高速缓存的共享内存多处理器中,任何一个指令操作数都可以有多个副本:一个在主内存中,一个在每个高速缓存中。当一个操作数的一个副本被修改时,其他副本也必须被修改。缓存一致性是确保共享操作数值的更改及时在整个系统中传播的规则。
2.内存一致性:
内存一致性定义了内存操作(来自任何进程)相对于彼此执行的顺序。
保留哪些订单?
给定一个负载,它可以返回哪些可能的值?
没有它就不可能详细说明 SAS(统计分析系统)的执行情况。对程序员和系统设计者的后果。
程序员使用程序来推理正确性和可能的结果。
系统设计人员可以使用它来限制可由编译器或硬件重新排序的访问次数。
程序员和系统之间的协议。
缓存一致性和内存一致性的区别:
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 |
5. |
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. |