[理工] 恐龍OS page fault
原題是這樣:
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;
恐龍解答是: a.50
b.5000
請問一下不是應該反過來嗎??
還是我漏看什麼@@?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.66.184
推
02/18 23:53, , 1F
02/18 23:53, 1F
→
02/19 00:11, , 2F
02/19 00:11, 2F
推
02/19 02:35, , 3F
02/19 02:35, 3F
推
02/19 02:39, , 4F
02/19 02:39, 4F
推
02/19 10:49, , 5F
02/19 10:49, 5F
→
02/19 11:31, , 6F
02/19 11:31, 6F