作者lock7863701 (Ayo)
看板Grad-ProbAsk
標題Re: [理工] [計組] 98雲科資工
時間Sat Mar 12 22:43:03 2011
※ 引述《focus78612 ()》之銘言:
: One cache system has 8 blocks that are initialized in empty.
: The size of cache block is 4-byte. The cache system uses
: two-way set associated architecture and LRU (least recently
: used) policy is used as replacement algorithm. When a set is
: referenced, way 0 is used first. Here is a series of address
: references: 1, 5, 8, 3, 40, 17, 19, 56, 49, 43. Please reference
: in the list as hit or miss?
: sol:
: address: 1 5 8 3 40 17 19 56 49 43
: M.M.block: 0 1 2 0 10 4 4 14 12 10
: set no.: 0 1 2 0 2 0 0 2 0 2
: H/M: M M M H M M H M M H
: Hit:3
: Miss:7
: 我不清楚的地方是set no.跟Hit/Miss怎麼判斷
: 會的高手可以教我一下嗎
: 謝謝
M.M. block = address div 4
set no. = M.M. block mod 4
4不是固定的,要用block數和set去算(有點忘了,可以請其他高手補充)
如果set no. 和 M.M.block 都一樣就是Hit
以address 1 來說是 0,0
address 3 也是 0,0 就算hit
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 182.234.4.96
推 focus78612:懂了 非常感謝 03/12 23:02
推 focus78612:想請問 如果採其他策略(如FIFO的話) 會差在哪呢? 03/12 23:25
→ lock7863701:每一個set裡面都有數個block,替換法則只有在這個set 03/12 23:36
→ lock7863701:中的block都滿了以後才會使用 03/12 23:36