Hi - I have a question and I know the answer too but don;t know how to explain my answer - could someone help me in explaining.
Consider the two-dimensional array A:
int A = new int;
where A 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[i][j] = 0; b. for (int i = 0; i < 100; i++) for (int j = 0; j < 100; j++) A[i][j] = 0;
Answer - A - 50 and B - 5000