Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider a two-dimensional array (matrix): int a[128][128]; Each integer takes 4

ID: 3812413 • Letter: C

Question

Consider a two-dimensional array (matrix): int a[128][128];

Each integer takes 4 bytes, and the matrix is stored in row order. The page size is 1024 bytes. For three frames, how many page faults are generated by the following loop-initialization loops using the LRU replacement? Assume that the program code occupies one frame and the other two frames are initially empty.

a.   for (int i = 0; i < 128; i++)

    for (int j = 0; j < 128; j++)

           a[i][j] = 0;

b.   for (int j = 0; j < 128; j++)

    for (int i = 0; i < 128; i++)

         a[i][j] = 0;

Explanation / Answer

total number of elements will be = 128 * 128 = 16384

page faults is = 16384B4 = 16