体系结构试验报告(cache存储过程)

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

体系结构实验报告

实验目的

通过程序,模拟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 时:

(2r

Direcflmapped

〉Cache

朿*

R

128 手

(3r Direcflmapped

〉Cache

助*

R

256

F

一pwsef 峑

s 2O J I 0

\^J.e e K ^g 63-L w g

JnnnrEd

理"巧 nm

rMecIrlxML

H

LJw

-dJ-LUf

J

F U »»

a i

B ci

n

IJr l

t

R

n x li 黑

*=£1

K s 1!蚯c a p w p llrt t M:C4mw J

L

l n rll n i H H

Hi L n h != l

£lx-瞌

忻恥f*<41.

«

F 2

3L L

/2\.*X «礼 j !H F i

对比实验结果,不难发现,随着Cache容量的增加,Cache的命中率一直在提升。分析原因发现,虽然Cache容量大了,但并不等于其预存的内容增多,所以命中率会上升。

3、比较Cache大小对于性能的影响。

(1)、Direct_mapped,关联度为 1 时:

(2)、Direct_mapped,关联度为2 时:

(3)、Direct_mapped,关联度为4 时:

(4) 、Direct mapped ,关联度为 8 时:

I ■ C -\LI wrs 1.11uwe

i mo\Dw_-m e ts'_Vi EUUI I ^tud o l£f Pre e-crE\tt. q\Dfft!uq\ti'g.-i-j r

IE Is-* -IrMHi

F OP n tiny Ret U

hiss

H41# a 聊

C4pnic4tv Conflict

nx5S

(5) 、Direct map ped ,关联度为 16 时:

可以看出,随着关联度的提高,命中率也有所增加

Canipuilsnry 1

XSE-

hH MuflfafiP = I44.MIUUM1

Ace R -S3 NumWr ■

-F

口寸 灭 」

eqlunu

>loo-q

〈 p ①ddelu —10

①」一q <

(L)

S

33I

詡M u

s y u s L l

's

童wr

#*■

L 書

-E .f n -s

r e U F K e$u

s.H

92

m £百

1-

*

E

*%

严一&丫

A

*u

-

u

k s ?

£

L

c 』 C

3"

f l a

毒* 1

和4£

s

E E *

B J W

11

v m 「>!5

q

言石-d ^l L l e l

E n p xll -,.I 曰右号v d d -o'w -o M n 「口釜l Y ci

-te L ^R 」

eqlunu

>loo-q 〈 p ①

ddelu —10①」Q <

通过以上三组数据不难看出,当block number增加时,命中率明显增高了。分析原因可知,这是由于程序局部性原理所造成的,当一次性多拿些附近的数据, 会有效的预测为下次用到的。

通过程序可以看出,这种方法会增加程序运行时间。

习题:利用Cache模拟器CacheSimulator 程序分析解决:

The followi ng C program is run (with no optimizatio ns) on a machi ne with a cache that has four-word(16-byte)blocks and holds 256 bytes of data:

int i, j, c, stride, array[256];

for (i=0; i<10000; i++)

for (j=0; j<256; j=j+stride)

c=array[j]+5;

if we con sider only the cache activity gen erated by refere nces to the array and we assume that in tegers are words, what is the expected miss rate when the cache is direct-mapped and stride=132? How about if stride=131? Would either of these cha nge if the cache were two-way set associative?

截取实验结果屏幕,分析实验结果,写出实验报告和实验心得。

1、当stride=132 时:

相关文档
最新文档