Q. A computer system is designed with a 64 KB direct-mapped cache having a…

Q. A computer system is designed with a 64 KB direct-mapped cache having a block size of 256 bytes.
The main memory contains a two-dimensional array A[1024][1024], where each element occupies 4 bytes.

During program execution, the following code segment is executed:

for (i = 0; i < 1024; i++) {

    for (j = 0; j < 1024; j++) {

        p = p + A[i][j];

    }

}

In this system, the cache is initially empty.
The array A is stored in row-major order, as per the C language convention, meaning consecutive elements of the same row are stored in contiguous memory locations.
During execution, only references to array A are considered for cache accesses, and each access corresponds to one 4-byte element.

Determine the total number of cache misses generated during the complete execution of the program and the number of cache misses generated while accessing the 7th row (i = 6), respectively

  1. A.

    1048576, 1024

  2. B.

    131072, 128

  3. C.

    16384,16

  4. D.

    4096,4

Attempted by 77 students.

Sign up free to check your answer

Sign up free

Explore the full course: Isro

Loading lesson…