Closed jasperzhong closed 3 years ago
当系统写数据到cache的时候,之后肯定要把这个数据写入到backing store.
write policy有两个基本方式:
所以write-back策略下,一次read miss会导致两次memory accesses: 一个是把要替换的data写入到backing store, 一个是retrieve需要的data.
wikipedia上的这两个图总结了上面流程:
A write-through cache with no-write allocation:
A write-back cache with write allocation:
顺带提一句,这些都是用硬件完成的.
脏数据(dirty data)指的是缓存上还没有写入到backing store的数据.
https://en.wikipedia.org/wiki/Cache_coherence
write-through vs write-back