假设有3个页面框架最初是空的。如果页面引用字符串是1、2、3、4、2、1、5、3、2、4、6,则使用最佳替换策略的页面错误数为__________。
(A) 5
(B) 6
(C) 7
(D) 8答案: (C)
说明:在最佳页面替换替换策略中,我们替换了将来最长使用时间的位置。
Given three page frames.
Reference string is 1, 2, 3, 4, 2, 1, 5, 3, 2, 4, 6
Initially, there are three page faults and entries are
1 2 3
Page 4 causes a page fault and replaces 3 (3 is the longest
distant in future), entries become
1 2 4
Total page faults = 3+1 = 4
Pages 2 and 1 don't cause any fault.
5 causes a page fault and replaces 1, entries become
5 2 4
Total page faults = 4 + 1 = 5
3 causes a page fault and replaces 5, entries become
3 2 4
Total page faults = 5 + 1 = 6
3, 2 and 4 don't cause any page fault.
6 causes a page fault.
Total page faults = 6 + 1 = 7
这个问题的测验