Consider the two-dimensional array A: int A[][] = new int[100][100];where A[0][0
ID: 3546931 • Letter: C
Question
Consider the two-dimensional array A:
int A[][] = new int[100][100];where A[0][0] is at location 200 in a paged memory system with pages of size 200. A small process that manipulates the matrix resides in page 0 (locations 0 to 199). Thus, every instruction fetch will be from page 0. For three page frames, how many page faults are generated by the following array-initialization loops, using LRU replacement and assuming that page frame 1 contains the process and the other two 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
Explanation / Answer
a) There are 50 pages and 100 faults per page. Hence We have, 50 x 100 = 5000 Page faults. b) 50 Page faults.Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.