并发学习之:缓存一致性
来源:互联网 发布:电脑配件 知乎 编辑:程序博客网 时间:2024/06/05 17:44
From: http://zhidao.baidu.com/question/214944467.html
From: http://en.wikipedia.org/wiki/Cache_coherence
首先明白什么是缓存,缓存是介于物理存储与CPU处理之间的一段内存空间,主要用于存储从物理存储读出、或者要写入的数据,这需要硬件或者软件支持。如果读取或写入物理存储中的一个字节或一段数据,如果没有缓存,那么每次的读写请求都会直接访问物理存储,而物理存储的速度一般都比较慢,而且物理定位也比较慢,缓存使用后,可以一次性读出需要的数据相邻的数据,暂时存储在缓存中,下面如果还要读取,而这部分数据已经在缓存了,就不需要再去读取物理存储,同样,如果是写操作,可以先将需要写入的数据暂时保存在缓存中,等到缓存过期或者强行清空时,再一次写入物理存储。这样可以把多次的物理存储访问,变成一次物理存储的访问,提高访问效率。具体的操作算法这里不多作阐述。缓存的一致性就是指缓存中的数据是否和目标存储中的数据是一样的,也就是说缓存中已经修改得数据是否已经保存到了物理存储中,物理存储中已经被修改得内容,是否与缓存的内容是一样的。这就是一致性的概念。
In computing, cache coherence (also cache coherency) refers to the consistency of data stored in local caches of a shared resource.
In a shared memory multiprocessor system with a separate cache memory for each processor, it is possible to have many copies of any one instruction operand: one copy in the main memory and one in each cache memory. When one copy of an operand is changed, the other copies of the operand must be changed also. Cache coherence is the discipline that ensures that changes in the values of shared operands are propagated throughout the system in a timely fashion.
There are three distinct levels of cache coherence:
- Every write operation appears to occur instantaneously
- All processes see exactly the same sequence of changes of values for each separate operand
- Different processes may see an operation and assume different sequences of values (this is considered noncoherent behavior)
In both level 2 behavior and level 3 behavior, a program can observe stale data. Recently, computer designers have come to realize that the programming discipline required to deal with level 2 behavior is sufficient to deal also with level 3 behavior.[citation needed] Therefore, at some point only level 1 and level 3 behavior will be seen in machines.[citation needed]
- 并发学习之:缓存一致性
- 微信公号“架构师之路”学习笔记(六)-互联网一致性架构设计(session一致性,主从一致性,双主一致性,缓存一致性,冗余一致性,消息时序一致性,分布式事务一致性,数据扣减一致性等)
- JAVA并发-从缓存一致性说volatile
- CAS原理之缓存一致性
- 【4】Java并发编程:多线程中的缓存一致性和CAS
- JAVA并发-从缓存一致性说volatile 讲的很好
- 缓存一致性
- 缓存一致性
- 聊聊高并发(五)理解缓存一致性协议以及对并发编程的影响
- java并发编程学习(六) 重排序和顺序一致性
- 缓存穿透、缓存并发、缓存失效之思路变迁
- 缓存穿透、缓存并发、缓存失效之思路变迁
- 缓存穿透、缓存并发、缓存失效之思路变迁
- 缓存穿透、缓存并发、缓存失效之思路变迁
- 缓存穿透、缓存并发、缓存失效之思路变迁
- 缓存穿透、缓存并发、缓存失效之思路变迁
- 缓存穿透、缓存并发、缓存失效之思路变迁
- 缓存穿透、缓存并发、缓存失效之思路变迁
- 如何定位Release程序崩溃原因
- Search in Rotated Sorted Array
- 错误提示“为空或不是对象”的解决方法
- oracle 创建表空间、表、主键、外键、序列
- char、varchar、text和nchar、nvarchar、ntext的区别
- 并发学习之:缓存一致性
- 网络字节序
- 我要发布第一篇程序文档
- 我是怎么找社区活动的志愿者和场地?
- Eclipse快捷键大全
- 网上投简历内幕
- 毕业5年决定人的一生-- 大家千万不要错过这篇文章
- linux查看及改变运行级别
- 利用MAP文件定位程序崩溃代码行