本文介绍了别名的定义/含义?(CPU 缓存架构)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对CPU 缓存和物理地址之间的别名" 的含义有些困惑.首先我在维基百科上找到了它的定义:

I'm a little confused by the meaning of "Aliasing" between CPU-cache and Physical address.First I found It's definition on Wikipedia :

然而,VIVT 存在别名问题,其中多个不同的虚拟地址可能引用同一个物理地址.另一个问题是同音异义词,即同一个虚拟地址映射到几个不同的物理地址.

但是过了一会儿我在演示文稿中看到了不同的定义(ppt)DAC'05 的:用于嵌入式处理器的高能效物理标记缓存虚拟内存"

but after a while I saw a different definition on a presentation(ppt)of DAC'05: "Energy-Efficient Physically Tagged Caches for Embedded Processors withVirtual Memory"

缓存别名和同义词:

别名:来自不同上下文的同一个虚拟地址映射到不同的物理地址同义词:不同的虚拟地址映射到同一个物理地址(数据共享)

Alias: Same virtual address from different contexts mapped to different physical addresses Synonym: Different virtual address mapped to the same physical address (data sharing)

由于我不是母语人士,我不知道哪个是正确的,虽然我觉得维基的定义是正确的.

As I'm not a native speaker, I don't know which is correct,though I feel the Wiki's definition is correct.

CPU 缓存中的别名"概念通常是同义词",反之则是同义词".在更通用的层面上,混叠"是混淆"或混乱"或类似的东西.所以在我看来,混叠"正是意味着 (X->Y) 的映射是非双射的",其中

Concept of "aliasing" in CPU cache usually means "synonym", on the contrary is "homonym". In a more generic level, "aliasing" is "confusing" or "chaos" or something like that. So In my opinion, "aliasing" exactly means the mapping of (X->Y) is "not bijective", where

"X" = 已缓存的物理地址单元的子集.(每个元素是一行字节)

"X" = the subset of physical addresses units which has been cached. (each element is a line of byte)

"Y" = 有效缓存行的集合.(元素也是行")

"Y" = the set of valid cache lines. (elements a also "line")

推荐答案

你需要先了解虚拟内存,但基本上是这样的:

You'd need to learn about Virtual Memory first, but basically it's this:

  • 您的程序使用的内存地址不是 RAM 使用的物理地址;它们是虚拟地址映射到 CPU 的物理地址.

  • The memory addresses your program uses aren't the physical addresses that the RAM uses; they're virtual addresses mapped to physical addresses by the CPU.

多个虚拟地址可以指向同一个物理地址.

Multiple virtual addressses can point to the same physical address.

这意味着您可以在不知情的情况下在缓存的不同部分拥有相同数据的两个副本......并且它们不会被正确更新,因此您会得到错误的结果.

That means that you can have two copies of the same data in separate parts of the cache without knowing it... and they wouldn't be updated correctly, so you'd get wrong results.

参考的摘录:

多个映射到内存的物理页面具有冲突的缓存状态(例如缓存和未缓存)时,会发生缓存别名.由于这些冲突状态,当处理器的缓存被刷新时,该物理页面中的数据可能会损坏.如果该页面正被驱动程序用于 DMA,则可能会导致硬件稳定性问题和系统锁定.


对于那些仍然不相信的人:

在 ARMv4 和 ARMv5 处理器上,缓存组织为虚拟索引、虚拟标记 (VIVT) 缓存,其中索引和标记都基于虚拟地址.这种方法的主要优点是缓存查找速度更快,因为转换后备缓冲区 (TLB) 不参与匹配虚拟地址的缓存行.但是,这种缓存方法确实需要更频繁的缓存刷新因为缓存别名,其中相同的物理地址可以映射到多个虚拟地址.

这篇关于别名的定义/含义?(CPU 缓存架构)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 14:31