GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A loop computes y[i] += A[i][j] × x[j] for a 32×32 matrix of 4-byte floats (A in row-major order at address 0, x at 4096, y at 4224); for each (i, j) it reads A[i][j] and x[j], and y[i] is read once per row. The data cache is 1 KB direct-mapped with 32-byte blocks. How many misses occur in total, and how many in a 2-way LRU cache of the same size, as (direct, 2-way)?

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

Correct answer: A. (376, 136)

Simulate every reference. The compulsory minimum is 136; in the direct-mapped cache blocks of A and of x map to the same lines and keep evicting x, giving 376, while 2-way LRU gives 136.

More Computer Organization and Architecture questions

Exams that ask this topic