edited by
392 views
1 votes
1 votes

A CPU has a $32$ KB direct-mapped cache with $128$byte block size. $’A’$ is a two dimensional array of size $512 \times 512$ with elements that occupy $8$bytes each.

for (j=0; j<512; j++)
{
    for (i=0; i<512; i++)
    {
        x +=A[j] [i];
    }
}

The number of cache misses in row major order is:

  1. $2^{11}$
  2. $2^{14}$
  3. $2^{18}$
  4. $2^{15}$
edited by

1 Answer

Best answer
3 votes
3 votes

 Number of lines in cache = 32 kB/28  

=> ( 25 * 210 )  / 28  = 27
No.of elements in one block= 128/ 8 = 27 / 23 =  24.
when 1st element is referred, we bring block number 0 of main memory to line number 0.we not only bring 1st element but also 24 elements(as we bring the whole block)... so when 1st element is referred, gives a miss.

next 24-1 elements gives hit.
miss rate 1/24.
no.of misses= (1/24) * number of references.
number of references = 512 * 512 (as each element is accessed once)
(1/24) * 218 = 214 misses.. option B .

selected by
Answer:

Related questions

1 votes
1 votes
3 answers
1