电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

北邮操作系统试验页面置换算法

北邮操作系统试验页面置换算法_第1页
1/12
北邮操作系统试验页面置换算法_第2页
2/12
北邮操作系统试验页面置换算法_第3页
3/12
课本第九章21 题 实验 ytinrete 1.实验目的: 学习页面置换算法 2.实验内容 Write a program that implements the FIFO and LRU page-replacement algorithms presented in this chapter. First, generate a random page reference string where page numbers range from 0..9. Apply the random page-reference string to each algorithm and record the number of page faults incurred by each algorithm. Implement the replacement algorithms 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++ 5 .程序源码 #include #include #include #include #include #include using namespace std; typedef struct block//页帧块结构 { int num; int lable; }block; int page_size, frame_size;//序列数,页帧大小 vector order;//存放序列 vector frame;//页帧 void page_replacement (int kind)//kind=1 为 FIFO,kind=2 为 LRU { //初始化 frame.clear(); block init; init.num=-1; init.lable=-1; for(int i=0; i

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

北邮操作系统试验页面置换算法

确认删除?
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群