作者cormen5566 (风行者)
看板Grad-ProbAsk
标题Re: [理工] 计组问题请问
时间Wed Apr 22 21:48:10 2009
※ 引述《loeooo (篮球狂)》之铭言:
: A page-replacement algo. minimizes the number of page faults by distributing
: heavily used pages evenly over all of memory. It associates with each
: page frame a counter of the number of pages that are associated with that
: frame, and the initial value of the coounters is 0. Then, to replace a page,
: it searches for the page frame with the smallest counter. The counters are
: increased whenver a new page is associated with that frame; and are decreased
: whenever one of the pages associated with that frame is no longer required.
: a) How many page faults occur for the algo. for the following reference string,
: for four page frames?
: 1,2,3,4,5,3,4,1,6,7,8,7,8,9,7,8,9,5,4,5,4,2.
: 这题在说什麽啊? 不太懂意思?? 可以顺便解个我看吗? 解前几个大概告诉我做法就好了
: 谢谢!!
这题大致上讲说,使用LRU的策略~
题目前半段大致上在讲LRU用counter的作法
1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2
___________________________________________
1 1 1 1 5 5 6 6 6 6 5 5 5
2 2 2 2 1 1 1 1 9 9 9 9
3 3 3 3 3 7 7 7 7 4 4
4 4 4 4 4 8 8 8 8 2
共13次的page faults
: b) what's the minimum number of page faults for an optimal page replacement
: strategy for the reference string in part (a) with four page frames?
: 这题是用最佳策略法吗? 我算出来11次 不知道跟大家算的一不一样耶??
1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2
___________________________________________
1 1 1 1 1 6 7 7 7 4 2
2 2 2 5 5 5 5 5 5 5
3 3 3 3 3 8 8 8 8
4 4 4 4 4 9 9 9
共11次page faults
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.229.77.39