下载后可任意编辑体系结构实验报告实验目的经过程序, 模拟 cache 存储过程, 并经过控制变量法模拟分析Cache 性能实验步骤: 我们要经过老师所给程序进行模拟, 并经过操作系统试验中老师所给算法生成出 project.txt, 并经过 project.txt 里面的数据来模拟程序的局部性等特性。一、 实验结果1、 比较关联方式, 控制 blockSize, CacheSize 不变: ( 1) 、 Direct_mapped: (2)、 Set_associate:下载后可任意编辑(3) 、 Fully_associate经过上述三个比较能够看出, 各种映射有自己的优点。可是不难看出, 增大关联度会减小 miss rate, 可是增加到一定程度又会有抑制作用。2.比较 Cache 大小对于性能的影响。( 1) 、 Direct_mapped, Cache 容量为 64 时: 下载后可任意编辑( 2) 、 Direct_mapped, Cache 容量为 128 时: ( 3) 、 Direct_mapped, Cache 容量为 256 时: 下载后可任意编辑对比实验结果, 不难发现, 随着 Cache 容量的增加, Cache 的命中率一直在提升。分析原因发现, 虽然 Cache 容量大了, 但并不等于其预存的内容增多, 因此命中率会上升。3、 比较 Cache 大小对于性能的影响。( 1) 、 Direct_mapped, 关联度为 1 时: ( 2) 、 Direct_mapped, 关联度为 2 时: 下载后可任意编辑( 3) 、 Direct_mapped, 关联度为 4 时: ( 4) 、 Direct_mapped, 关联度为 8 时: 下载后可任意编辑( 5) 、 Direct_mapped, 关联度为 16 时: 能够看出, 随着关联度的提高, 命中率也有所增加。4、 比较 block Number 对于 Cache 性能影响。( 1) 、 Direct_mapped, block number 为 1 时: ( 2) 、 Direct_mapped, block number 为 2 时: 下载后可任意编辑( 1) 、 Direct_mapped, block number 为 4 时: 经过以上三组数据不难看出, 当 block number 增加时, 命中率明显增高了。分析原因可知, 这是由于程序局部性原理所造成的, 当一次性多拿些附近的数据, 会有效的预测为下次用到的。经过程序能够看出, 这种方法会增加程序运行时间。习题: 利用 Cache 模拟器 CacheSimulator 程序分析解决: The following C program is run (with no optimizations) on a machine with a cache that has four-word(16-byte)blocks 下载后可任意编辑and holds 256 bytes of data:int i, j, c, stride,...