Re: [理工] [計組] 算出cache的 miss rate
※ 引述《mqazz1 (無法顯示)》之銘言:
: ※ 引述《lexa ( )》之銘言:
: : Media applications that play audio or video files are part of a class of
: : workloads called "streaming" workloads; i.e., they bring in large amounts
: : of data but do not reuse much of it. Consider a video streaming workload
: : that access a 512KB working set sequentially with the following address stream:
: : 0,4,8,12,16,20,24,28,32, ...
: : (1)Assume a 64KB direct-mapped cache with a 32-byte line. What is the miss
: : rate for the address stream above. How is this miss rate sensitive to the
: : size of the cache or the working set? How would you categorize the misses
: : this workload is experiencing, based on the 3C model.
: 64KB direct-mapped / 512KB working set = 2^16 / 2^19 = 2^(-3) = 1/8 = 12.5%
不好意思 以我的個人想法(不保證對) miss rate應該是這樣算的
一開始access 0 會miss 所以cache會拿一塊size為32bytes的block
這個block所含得data 就是memory裡address為 0~31 的data
所以接下來access 4,8,12,16,20,24,28 都會hit
到了 32 又會miss 跟上述差不多的動作
所以可以想成 每 8 個access裡 會有 1 個miss
miss rate = 12.5%
所以miss rate應該是只跟block size有關 (compusory miss)
: 32 byte line size時的miss rate是12.5%
: 這是compulsory miss rate 應該不會影響cache和working set的大小
: : (2)Recompute the miss rate when the cache line size is 16 byte , 64 bytes, and
: : 128 bytes? What Kind of locality is this workload exploiting?
: cache line size越小 miss rate會越高
: 照比例去算就可以了
: 16 byte => 12.5% * 2 = 25%
: 64 byte => 12.5% * 1/2 = 6.25%
: 128 byte => 12.5% * 1/4 = 3.125%
: : 答案:
: : (1)12.5% miss rate. The miss rate doesn’t change with cache size or working
: : set. These are cold misses.
: : (2)25%, 6.25% and 3.125% miss rates for 16-byte, 64-byte and 128-byte blocks.
: : Spatial locality.
: : 我主要是想問第1題12.5%是怎麼算出來的?
--
↑↑↑ (((──╮ o O ○
◢╳|███◣ ∕◢██◣﹨≡ 濱口組長眉頭一皺,
██|████ \ ㄟˇㄏ /≡
██|████ 【 ⊙..⊙ 】≡ 覺得插到的魚並不單純。
◥╳|████ ◥ /◎||||\◤
╰┼╯◤ ▆▅▅▆ cynic5566
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.138.24
※ 編輯: feabries 來自: 140.113.138.24 (10/27 00:10)
推
10/27 20:42, , 1F
10/27 20:42, 1F
→
10/27 20:42, , 2F
10/27 20:42, 2F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):