北邮 操作系统试验 页面置换算法
北邮 操作系统试验 页面置换算法
课本第九章21题 实验
ytinrete
1.实验目的:
学习页面置换算法
2.实验内容
Write a program that implements the FIFO and LRU page-replacementalgorithms presented in this chapter. First, generate a random pagereferencestring where page numbers range from 0..9. Apply the randompage-reference string to each algorithm and record the numberof page faults incurred by each algorithm. Implement the replacementalgorithms such that the number of page frames can vary from 1..7.Assume that demand paging is used.
写一个程序来实现本章中介绍的FIFO和LRU页置换算法。首先产生一个随机的页面引用序列,页面数从0~9。将这个序列应用到每个算法并记录发生的页错误的次数。实现这个算法时,要将页帧的数量设为可变(从1~7)。假设使用请求调页。
3.设计说明
FIFO算法:
每次请求先查找是否有空块,有则替换,并标记为最晚到达,若没有则从标记中寻找最新到达的块,替换,并更新标记表。标记数字越小,到达时间最早。 LRU算法:
每次请求先查找是否有空块,有则替换,并标记为最近使用时间最短者,若没有则从标记中寻找最近使用时间最长者,替换,并更新标记表。标记数字越小,最近使用频率越低。
4.实验环境
windows7 ultimate x64 with sp1
Dev-c++


