578
技术社区[云栖]
计算机体系结构6_缓存结构
一,缓存结构
下图为一个n-way set-associative cache 结构图:
缓存组织为cache line数组的形式,每一个cache line由三部分组成,内存数据,tag,其他信息。
多个cache line一行,组成一个set,一列cache line为way,在n-way set-associative cache中,每个set由n个cache line
组成,例如一个4-way set-associative cache,每个set由4个cache line组成,每个way一个cache line。
二,缓存索引
通过物理地址获取数据或指令在缓存中的位置(set, way, byte),每个物理地址被分为三部分:
Index,选择缓存的行(set),同一行中的所有cache line通过index域选择。
tag,选择一行(set)中特定的cache line,物理地址的tag域与每个cache line的tag域进行比较,如果匹配,则发出cache hit信号
,选择此cache line,否则发出cache miss信号。
offset,物理地址在cache line中的第一个byte,数据或指令从此byte的位置读取。
三,fully associative cache、direct-mapped scheme和set-associative scheme
direct mapped, if each entry in main memory can go in just one place in the cache, the cache is .
fully associative, If the replacement policy is free to choose any entry in the cache to hold the copy.
N-way set associative, Many caches implement a compromise in which each entry in main memory can go to any one of N places in the cache.
因此2-way set associative意味着,主存中的任意一个entry在缓存中有两个可以保存的位置。
参考:
AMD64 Architecture Programmer’s Manual Volume 2: System Programming
最后更新:2017-04-03 14:54:08
上一篇:
反射中的Constructor和数组反射
下一篇:
poj 1543 Perfect Cubes【sort排序结构体】
基于图卷积网络的图深度学习
阿里云机器学习平台的思考
[WCF REST] Web消息主体风格(Message Body Style)
HDU 1756 判断点在多边形内外
Changing the Way of Continuous Delivery with Docker (Part 1)
HDU 3978 斐波那契循环节
卡尔曼滤波简介及算法实现代码
Android framework/base 下添加新的接口
Tomcat5发布项目问题(1):jstl java.lang.NoClassDefFoundError javaxelValueExpression
绝对定位元素水平垂直居中的两种常见方法