GATE / CS ARCHIVE

GATE CSE 2009 / QUESTION 29

Four-way set-associative LRU contents

Computer Organization & Architecture · Cache Memory · Full GATE CSE 2009 paper

GATE 2009, Q29 2 marks · MCQ
Report issue

Cache Memory

Question 29, GATE 2009: An initially empty four-way cache has 16 blocks and memory 256 blocks. Reference sequence:0, 255, 1, 4, 3, 8, 133, 159, 216, 129, 63, 8, 48, 32, 73, 92, 155. With LRU within each set, which block is absent at the end? A 3; B 8; C 129; D 216.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

There are 16/4=4 sets, selected by block number modulo 4. Simulating LRU gives oldest-to-newest final sets: set 0=[8, 48, 32, 92], set 1=[1, 133, 129, 73], set 2=[], set 3=[3, 159, 63, 155]. Thus 3, 8, 129 remain but 216 has been evicted, D. In set 0, insertion 32 removes 4 and insertion 92 removes 216 after 8 was refreshed.

There are 16/4=4 sets; choose set number by block modulo 4. Only blocks mapping to the same set compete for four ways. In set 0, references are 0, 4, 8, 216, 8, 48, 32, 92. The second 8 refreshes its recency; inserting 48 removes 0, 32 removes 4, and 92 removes 216. The final set is 8, 48, 32, 92. Other sets retain 3 and 129. Hence 216, option D, is the absent listed block.

Original paper, page 6