GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A program sums a 64 × 64 matrix of 4-byte ints stored in row-major order starting at address 0, once row by row and once column by column. The data cache is direct-mapped, 2 KB, with 32-byte blocks (empty before each traversal). How many misses do the row-wise and column-wise traversals cause, as (row, column)?

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

Correct answer: C. (512, 4096)

Row-wise reads each 32-byte block once: 4096/8 = 512 misses. Column-wise the stride is 256 B = 8 blocks, so only 8 distinct lines (8i mod 64) are ever used, and each line is evicted before the next element of its block is needed: every one of the 4096 accesses misses.

More Computer Organization and Architecture questions

Exams that ask this topic