retagged by
599 views
0 votes
0 votes
Consider below code written in C  
         Loop A
sum = 0;
 for (i = 0; i < 128; i++)
for (j = 0; j < 64; j++)
        sum += A[i][j];
         Loop B
sum = 0;
for (j = 0; j < 64; j++)
for (i = 0; i < 128; i++)
                                    sum += A[i][j];
The matrix A is stored contiguously in memory in row-major order. Consider a 4KB direct-mapped data cache with 8-word (32-byte) cache lines.

Calculate the number of cache misses that will occur when running Loop A.

i)1392 misses

ii) 1024 misses

iii)1020 misses

iv)1323 misses
retagged by

1 Answer

Related questions

0 votes
0 votes
0 answers
2
amitqy asked Mar 16, 2019
294 views
Can someone please provide a link to an article or a video explaining cache and arrays concept. Im having a hard time understanding that concept.
0 votes
0 votes
1 answer
4
Anuranjan asked Mar 17, 2019
243 views
How to improve cache hit rate in case of transfer of element from 2-D array to matrix.? (Consider the column major order in 2D array)