9 views

Consider the following extract from a program, written in a C-like language, that computes the transpose of a matrix.

for (i=0; i<N; i++)
for (j=0; j<N; j++)
B[i,j]=A[i,j];

$A$ and $B$ are $N \times N$ matrices with floating point etries that are stored in memory in row-major order as shown in the example below:

 A[0,0] A[0,1] A[0,2] ... A[0,N-1] A[1,0] A[1,1] ... A[N-1,N-1]

This program runs uder an OS that uses demand-paging. Considering ONLY memory references to the matrix entries, and using the information given below, compute the page fault rate for the matrix transposition code given above.

• Page size: $2^{10} bytes • Number of frames allocated to the program: 8 • Page replacement policy: LRU •$N=2^{16}$• Size of each matrix entry: 8 bytes • Each of$A$and$B$is stored starting from the beginning of a page • None of the pages allocated to$A$and$B\$ are initially in memory.
asked in Others | 9 views