作者tedmax100 (tedmax)
看板Grad-ProbAsk
標題[理工] [OS]-關於矩陣的page fault
時間Sat Jan 30 18:30:58 2010
Consider the two dimensional array A:
int A[][] = new int [50] [50];
where A[0][0] is at location 100, A[0][1] at 102, and A[0][2] at 104, etc.,
in a paged system with pages of size 100 bytes. A small process is in page 0
(locations 0 to 99) for manipulating the matrix; thus, every instruction
fetch will be from page 0.
Assume that there are five pages frames; page frame 1 has the process in it
and the other four are initially empty. Consider two different page
replacement algorithms: FIFO and LRU, and the following loop.
for (int j = 0; j < 50; j++)
for (int i = 0; i < 50; i++)
A[i][i] = 0;
1) List the page reference string for the execution of the loop. (5%)
2) For each replacement algorithm, how many page faults are generated by the
loop? (8%)
請問一下 這兩小題怎解@@ , 麻煩了
第2小題答案是25次PF?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.117.206.69
推 trovadores:請問題目確定是A[i][i],還是A[j][i]? 01/30 23:14
→ tedmax100:考卷上是Aii 不過我也在想應該是Aji 01/30 23:23
→ guts:有高手可以幫解一下嗎?!!!!小弟也對這題有疑惑 ...... 01/31 14:11