GATE Computer ScienceVery hardGATE CS

A loop body occupies the 160 bytes from address 0x1000 to 0x109F and runs 100 iterations. The instruction cache is direct mapped, 128 bytes with 16-byte blocks (8 lines), and starts empty; every instruction of the loop is fetched once per iteration in order. How many instruction-cache misses occur in total?

  1. A. 400
  2. B. 410
  3. C. 406
  4. D. 1000

Correct answer: C. 406

The loop has 10 blocks, but only 8 lines, so the 9th and 10th blocks evict those in lines 0 and 1. In steady state each iteration misses on 4 blocks (0, 1, 8 and 9), while blocks 2 to 7 hit, so the total is 10 + 99 × 4 = 406.

More Computer Organization and Architecture questions

Exams that ask this topic