Hi - I have a question and I know the answer too but don;t know how to explain my answer - can someone help me in explaining.
Consider the two-dimensional array A:
int A[][] = new int[100][100];
where A[0][0] is at location 500 in a paged memory system with pages of size 500 (a little unrealistic -- not 512). A small process that manipulates the matrix resides in page 0 (locations 0 to 499). Thus, every instruction fetch will be from an instruction currently stored in page 0.
Assuming there are only three page frames, including page 0, how many page faults are generated by the following array-initialization loops, using LRU replacement and assuming that page frame 0 contains the process and the other three are initially empty?
a. for (int j = 0; j < 100; j++)
for (int i = 0; i < 100; i++)
A[j] = 0;
b. for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
A[j] = 0;
Answer - A - 50 and B - 5000