GATE / CS ARCHIVE

GATE CSE 2017 SET 1 / QUESTION 51

GATE CSE 2017 Set 1 Q51

Computer Organization & Architecture · Cache Memory · Full GATE CSE 2017 Set 1 paper

GATE 2017 Set 1, Q51 2 marks · NAT
Report issue

Cache Memory

Question 51, GATE 2017: A 256-block, 2-way set-associative cache uses LRU and starts empty. Repeat this block-reference sequence ten times: 0,128,256,128,0,128,256,128,1,129,257,129,1,129,257,129. Count conflict misses, excluding compulsory first-access misses.
Tap to enlarge
Answer & solution

Official answer: 76.0

Our answer: 76

1. There are 256/2=128 sets. Block number modulo 128 puts {0,128,256} in set 0 and {1,129,257} in set 1; each set holds only two blocks.

2. For the first set-0 subsequence 0,128,256,128,0,128,256,128 the outcomes are compulsory,compulsory,compulsory,hit,conflict,hit,conflict,hit. LRU ends with 256 then 128 from least to most recent. Set 1 behaves identically.

3. Each later subsequence starts with those two survivors: accesses to its first,third,fifth,seventh entries miss, all now conflicts. Thus repetition 1 has four conflicts total, and each of nine later repetitions has eight. Total=4+9×8=76 conflicts, alongside six compulsory misses.

Original paper, page 23 · Answer key