冲突缺失和容量缺失之间有什么区别 [英] What's the difference between conflict miss and capacity miss

查看:445
本文介绍了冲突缺失和容量缺失之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发生容量丢失是因为正在从缓存中丢弃块,因为缓存无法包含程序执行所需的所有块(程序工作集远大于缓存容量)。

Capacity miss occurs because blocks are being discarded from cache because cache cannot contain all blocks needed for program execution (program working set is much larger than cache capacity).

在集合关联或直接映射的块放置策略的情况下,发生冲突丢失;当几个块被映射到同一集合或块帧时,发生冲突丢失。也称为碰撞错过或干扰错过。

Conflict miss occurs in the case of set associative or direct mapped block placement strategies, conflict misses occur when several blocks are mapped to the same set or block frame; also called collision misses or interference misses.

它们实际上是密切相关的吗?

Are they actually very closely related?

例如,如果所有高速缓存行已满,我们有一个对内存B的读取请求,为此我们必须逐出内存A。

For example, if all the cache lines are filled and we have a read request for memory B, for which we have to evict memory A.

因此,应将其视为容量缺失,因为我们没有足够的空间?然后,如果我们要访问内存A,并且由于它之前已经被撤出,则被认为是冲突未命中。

So should it be considered as a capacity miss since we don't have enough space? And later if we want to access memory A, and since it's evicted before, it's considered as a conflict miss.

我正确理解吗?谢谢

推荐答案

此处的重要区别在于,数据集大小导致的缓存未命中与数据集方式导致的缓存未命中

The important distinction here is between cache misses caused by the size of your data set, and cache misses caused by the way your cache and data alignment are organized.

让我们假设您拥有32k直接映射的缓存,并考虑以下两种情况:

Lets assume you have a 32k direct mapped cache, and consider the following 2 cases:


  1. 您反复遍历一个128k数组。数据无法容纳在该缓存中,因此所有未命中都是容量错误(除了对每行的第一次访问是强制性未命中,即使您可以无限增加缓存也将保留)。

  1. You repeatedly iterate over a 128k array. There's no way the data can fit in that cache, therefore all the misses are capacity ones (except the first access of each line which is a compulsory miss, and would remain even if you could increase your cache infinitely).

您有2个小的8k数组,但不幸的是它们都对齐并映射到相同的集合。这意味着,尽管它们在理论上可以放入缓存中(如果您调整对齐方式),但它们将不会利用完整的缓存大小,而是竞争同一组集合并互相竞争。这些是冲突遗漏,因为数据可以容纳,但仍因组织冲突而冲突。设置关联的缓存可能会发生相同的问题,尽管次数较少(假设缓存是2向缓存,但是您有4个对齐的数据集...)。

You have 2 small 8k arrays, but unfortunately they are both aligned and map to the same sets. This means that while they could theoretically fit in the cache (if you fix your alignment), they will not utilize the full cache size and instead compete for the same group of sets and thrash each other. These are conflict misses, since the data could fit, but still collides due to organization. The same problem can occur with set associative caches, although less often (let's say the cache is 2-way, but you have 4 aligned data sets...).

这两种类型确实是相关的,您可以说,鉴于高度的关联性,设置偏斜,正确的数据对齐方式和其他技术,您可以减少冲突,直到您大多留下了不可避免的真实容量错误。

The 2 types are indeed related, you could say that given high levels of associativity, set skewing, proper data alignments and other techniques, you could reduce the conflicts, until you're mostly left with true capacity misses that are unavoidable.

这篇关于冲突缺失和容量缺失之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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