5.2 Directory protocol
:material-circle-edit-outline: 约 338 个字 :material-clock-time-two-outline: 预计阅读时间 1 分钟
Directory-based Cache coherence
Distributed Shared Memory 模式下,内存分为本地内存和远程内存,不是共享内存了,上面的办法就用不了了
我们就得改用 Directory protocol
Directory protocol
基本思路是,用目录记录所有 memory block 的状态,以此调控 cache block
Directory: track state of every block in memory
we change the state of block in cache according to directory
- Information in directory
- Status of Every block: shared / uncached / exclusive
- Which processors have copies of the block: bit vector
- 一个位对应一个处理器是否有对应的 copy
- Whether the block is dirty or clean
Directory protocol can be implemented with a distributed memory:
Directory protocol implementation
- Block status
- Shared:≥ 1 processors have data, memory up-to-date
- Uncached:no processor has it; not valid in any cache
- Exclusive:1 processor (owner) has data; memory out-of-date
- Directory size = entry number * entry size)
Directory Protocol
- Local node 发起请求的结点
- Home node where the memory location of an address resides
- Remote node has a copy of a cache block, 且数据是最新的
目录协议相互之间的通信都可以抽象为三个结点之间发消息
消息需要至少包括:发送者 P = processor number, 请求的地址 A = address
所有会产生的消息的情况,以及对应的消息含义如下:
invalidate 就是,我要写数据了,请 home 查找目录,通知所有有 copy 的 node将该数据无效化
CPU -Cache State Machine
Directory State Machine
[!EXAMPLE]
PPT 60