GATE Computer ScienceHardGATE CS (PYQ pattern)

Three caches with 4 one-word lines each see the block trace [0, 1, 2, 3, 0, 4, 1, 5, 2, 6, 3, 7, 0, 4]: (i) direct-mapped, (ii) 2-way set-associative with LRU, (iii) fully associative with LRU. How many hits does each produce, as (i, ii, iii)?

  1. A. (4, 2, 4)
  2. B. (1, 2, 4)
  3. C. (4, 2, 1)
  4. D. (4, 1, 2)

Correct answer: C. (4, 2, 1)

More associativity does not always mean more hits: this trace sweeps 8 blocks, and LRU keeps evicting exactly the block that returns next, while the direct-mapped cache happens to keep blocks 1, 2, 3 across their second use (the early repeats). Simulating gives (4, 2, 1).

More Computer Organization and Architecture questions

Exams that ask this topic