冲突未命中和容量未命中有什么区别 [英] What's the difference between conflict miss and capacity miss

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

问题描述

由于缓存无法包含程序执行所需的所有块(程序工作集远大于缓存容量)而导致从缓存中丢弃块,因此发生容量缺失.

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...).

这 2 种类型确实相关,您可以说,考虑到高水平的关联性、集合偏斜、正确的数据对齐和其他技术,您可以减少冲突,直到大部分情况下都留下不可避免的真正容量缺失.

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天全站免登陆