作者hunter0904 (態度)
看板Grad-ProbAsk
標題[理工] [計組]cache的題目
時間Tue Dec 28 00:29:02 2010
A program accesses each element of a 1000*1000 matrix
10 times in the course of execution.Only 1% of this
matrix fits in the data cache at any given time.
A cache line holds 4 matrix elements.
a.How many compulsory data cache misses will
be caused by this program's execution?
b.If all 10^6 matrix elements are accessed once in round i
before accesses in round i+1 begin,
how many capacity misses will there be?
答案是
a.10^6/4
b.250000*9
完全不明白 怎麼看
救命= = 請高手解答囉 感恩
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.126.122.101
1F:→ aoqq12:那解答是正確的嘛@@ 第一題算出來感覺是 10^4/4 12/28 09:40
2F:推 skill91002:樓上是不是把1%乘進去了 compulsory應該是只要是第一次 12/28 10:10
3F:→ skill91002:存取的話就有,所以應該是一共有10^6/4個不同的lines, 12/28 10:11
4F:→ skill91002:所以有這麼多個compulsory misses 12/28 10:11
5F:→ skill91002:第二小題我覺得是,因為cache只有2500個lines,而一次 12/28 10:59
6F:→ skill91002:需要250000個lines,題目說每一個round都會做完完整一 12/28 11:00
7F:→ skill91002:次,所以會替換掉250000-2500個lines,這就是一次的 12/28 11:01
8F:→ skill91002:capacity miss,總共執行10次,所以是 12/28 11:01
9F:→ skill91002:(250000-2500)*10 = 250000*(10-1) = 250000*9 12/28 11:02
10F:→ skill91002:阿等等!怎麼答案算起來是25000*99...白忙一場別理我T_T 12/28 11:06
11F:→ hunter0904:我想問他題目的意思是說 他存取十次嗎? 這樣應該不是每 12/28 17:29
12F:→ hunter0904:個entry都會存取到吧?? 12/28 17:30
13F:→ aoqq12:那個1%不是說 cache 只能容納1%的資料嗎? 12/28 17:30