MSI:为什么当其他CPU要覆盖它时我们需要写回该行? [英] MSI: Why do we need to write the line back when other CPU is going to override it?

查看:68
本文介绍了MSI:为什么当其他CPU要覆盖它时我们需要写回该行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Hennessy/Patterson着的计算机体系结构"一书(第5版,第360页)中,他们描述了MSI协议,并编写了以下内容:

In the book "Computer Architecture", by Hennessy/Patterson, 5th ed, on page 360 they describe MSI protocol, and write something like:

如果该线路处于状态独占"(已修改),则当从总线接收到写小姐"时,当前CPU 1)将线路写回到总线,然后2)进入无效"状态.

If the line is in state "Exclusive" (Modified), then on receiving "Write Miss" from the bus the current CPU 1) writes back the line into the bus, and then 2) goes into "Invalid" state.

为什么如果其他CPU的连续写操作仍会覆盖该行,我们为什么需要写回该行?

每个CPU应该看到相同的写入是否与事实有关?(但我不明白为什么看不到其他CPU的这种特殊写入是一个问题)

Is it connected with the fact that every CPU should see the same writes? (but I don't see why is it a problem not see this particular write by some other CPU)

这是他们书中的协议(绿色的问题,紫色的问题很明显:我们需要回写以便将行提供给请求的CPU):

Here is the protocol from their book (question in green, in purple it is clear: we need to write-back in order to supply the line to requesting CPU):

推荐答案

在MSI协议中,严格不需要将修改后的数据写回内存.状态图似乎还假设系统具有低成本的内存访问权限(即使在另一个缓存中处于共享状态时,数据也由内存提供),并且共享总线连接到内存接口.

Writing back the modified data to memory is not strictly necessary in a MSI protocol. The state diagrams also seem to assume a system with low cost memory access (data is supplied by memory even when found in the shared state in another cache) and a shared bus connecting to the memory interface.

但是,由于请求的处理器可能仅在修改高速缓存块的一部分(例如,仅一个字节),因此不能像共享状态那样简单地删除已修改的数据.无论请求内存中未被修改的块的任何部分,都必须在内存中或在请求处理器中仍然可用(另一个处理器已经使它的副本无效).使用共享总线和低成本内存访问,仅通过将数据传送到另一个处理器就可以在内存中添加回写,因此成本差异很小.

However, the modified data cannot simply be dropped as in shared state since the requesting processor might only be modifying part of the cache block (e.g., only one byte). Whatever portions of the block that are not modified by the requesting processor must still be available either in memory or at the requesting processor (the other processor has already invalidated its copy). With a shared bus and low cost memory access the cost difference of adding a write-back to memory over just communicating the data to the other processor is small.

此外,即使在具有字大小的高速缓存块的字寻址系统中,保持旧数据可用也可以以推测方式发送写未命中请求(如无序执行或写预取)没有正确性问题.

In addition, even on a word-addressed system with word-sized cache blocks, keeping the old data available allows the write miss request to be sent speculatively (as with out-of-order execution or prefetch-for-write) without correctness issues.

(对修改后的状态(或作为修改后的超集有效)的每字节跟踪可以避免某些数据通信,但要付出额外的状态位和更复杂的通信系统的代价.)

(Per-byte tracking of modified [or valid as a superset of modified] state would allow some data communication to be avoided at the cost of extra state bits and a more complex communication system.)

这篇关于MSI:为什么当其他CPU要覆盖它时我们需要写回该行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆