【计算机组成与设计】-第五章 memory hierarchy(三)

5.4 Measuring and Improving Cache Performance

Cache association

Cache line的映射方式主要有三种:directed mapping、full associative、set associative。

可以通过灵活的映射方式来reducing miss rate。

Directed mapping:

每个memory block只能存在cache中一个cache line。

每次加载一个新的memory block,都要把某个cache line替换掉,miss rate较大。

Full associative:

每个memory block可以存放在cache中的所有的cache line。

在确定cache是否hit的时候,需要较多的硬件资源;一般适用于cache line number较少的cache。

Set-associative 组相连

一般是n-way set associative(n路组相连)。

每个set有n个cache line组成,每个memory block可以放在某个set的任何一个cache line中。

Way代表一个memory block可以放在几个cache line中。

从另一个角度来说,三种mapping方式都是set -associative,只不过way不同

Locating block in set associative cache

在set associative cache中,地址中的index field是用来索引哪个set的,到底是set中的哪个cache line还要通过比对tag来决定。对比tag的过程是同时进行的——如果是4 way,那么需要四个比较器。

下图中是4way cache,共有256个set。

Replacing block strategy

一般是LRU(least recently used)

Reducing the Miss Penalty Using Multilevel Caches

 In particular, a two-level cache structure allows the primary cache to focus on minimizing hit time to yield a shorter clock cycle or fewer pipeline stages, while allowing the secondary cache to focus on miss rate to reduce the penalty of long memory access times.

the primary cache of a multilevel cache is often smaller. Furthermore, the primary cache may use a smaller block size, to go with the smaller cache size and also to reduce the miss penalty.

In comparison, the secondary cache will be much larger than in a single-level cache, since the access time of the secondary cache is less critical.With a larger total size, the secondary cache may use a larger block size than appropriate with a single-level cache. It often uses higher associativity than the primary cache given the focus of reducing miss rates.

参考:

1. 计算机组成与设计 第五版 ARM版

这本最畅销的计算机组成书籍经过全面更新,关注现今发生在计算机体系结构领域的革命性变革:从单处理器发展到多核微处理器。此外,出版这本书的ARM版是为了强调嵌入式系统对于全亚洲计算行业的重要性,并采用ARM处理器来讨论实际计算机的指令集和算术运算,因为ARM是用于嵌入式设备的最流行的指令集架构,而全世界每年约销售40亿个嵌入式设备。与前几版一样,本书采用了一个MIPS处理器来展示计算机硬件技术、流水线、存储器层次结构以及I/O等基本功能。此外,本书还包括一些关于x86架构的介绍。   本书主要特点   ·采用ARMv6(ARM11系列)为主要架构来展示指令系统和计算机算术运算的基本功能。   ·覆盖从串行计算到并行计算的革命性变革,新增了关于并行化的一章,并且每章中还有一些强调并行硬件和软件主题的小节。   ·新增一个由NVIDIA的首席科学家和架构主管撰写的附录,介绍了现代GPU的出现和重要性,首次详细描述了这个针对可视计算进行了优化的高度并行化、多线程、多核的处理器。   ·描述一种度量多核性能的独特方法——“Roofline model”,自带benchmark测试和分析AMD Opteron X4、Intel Xeon 5000、Sun UltraSPARC T2和 IBM Cell的性能。   ·涵盖了一些关于闪存和虚拟机的新内容。   ·提供了大量富有启发性的练习题,内容达200多页。   ·将AMD Opteron X4和Intel Nehalem作为贯穿本书的实例。   ·用SPEC CPU2006组件更新了所有处理器性能实例。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值