版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、传播优秀word版文档 ,希望对您有帮助,可双击去除!存储器管理1实验内容:模拟请求页式存储管理中硬件的地址转换和缺页中断,并用先进先出调度算法(fifo)处理缺页中断;2要求: 指令序列的设定可以执行拟定,格式如表3; 在完成了fifo换页策略后,可以选做lru的换页策略,并进行比较; 作业允许的页架数m在不同情况下的缺页中断率; 程序运行时显示地址转变和页面调入调出过程。3.实验控制流图:4数据结构核心代码:传播优秀word版文档 ,希望对您有帮助,可双击去除!package xiao.zhang.bean;public class instruction /* * 指令操作符号 */pr
2、ivate string op;/* * 页号 */private int pageid;/* * 页内地址 */private int pageinaddress;public instruction() public instruction(string op, int pageid, int pageinaddress) this.op = op;传播优秀word版文档 ,希望对您有帮助,可双击去除!this.pageid = pageid;this.pageinaddress = pageinaddress;public string getop() return op;public
3、void setop(string op) this.op = op;public int getpageid() return pageid;public void setpageid(int pageid) this.pageid = pageid;public int getpageinaddress() return pageinaddress;public void setpageinaddress(int pageinaddress) this.pageinaddress = pageinaddress;传播优秀word版文档 ,希望对您有帮助,可双击去除!/* * (non-ja
4、vadoc) * * see java.lang.object#tostring() */overridepublic string tostring() return "instruction op=" + this.op + ", pageid=" + this.pageid+ ", pageinaddress=" + this.pageinaddress + ", getop()="+ this.getop() + ", getpageid()=" + this.getpageid()+
5、", getpageinaddress()=" + this.getpageinaddress()+ ", getclass()=" + this.getclass() + ", hashcode()="+ this.hashcode() + ", tostring()=" + super.tostring() + ""package xiao.zhang.bean;import java.util.linkedlist;public class executefifo 传播优秀word版文档
6、,希望对您有帮助,可双击去除!/* * 指令队列 */public linkedlist<instruction> is;/* * 页面存储 */public linkedlist<page> pages;/* * 是否还有存储页架 */private final int isuseablepageframe;public static int point = 0;/* * 默认设置页架为4个 */public executefifo() this.isuseablepageframe = 4;传播优秀word版文档 ,希望对您有帮助,可双击去除!public exec
7、utefifo(int isuseablepageframe) is = new linkedlist<instruction>();pages = new linkedlist<page>();this.isuseablepageframe = isuseablepageframe;public executefifo(linkedlist<instruction> is, linkedlist<page> pages,int isuseablepageframe) this.is = is;this.pages = pages;this.is
8、useablepageframe = isuseablepageframe;/* * 一次性调度完成,装载所有的可用的页 */public void initalexecute() for (int i = 0; i < isuseablepageframe; i+) /* * 从指令队列出一条指令 */传播优秀word版文档 ,希望对您有帮助,可双击去除!instruction ins = is.poll();/* * 访问指定页号的主存 */page p = pages.get(i);p.setpageid(ins.getpageid();p.setinmen(true);p.set
9、modifyflag(ismodify(ins.getop();printininformation(ins);/* * 执行指令 */public void executeinstruction() /* * 先判断执行的页是否住存 指令序列中将其删除 */while (!is.isempty() instruction ins = is.poll();if (isexistmemeroy(ins) 传播优秀word版文档 ,希望对您有帮助,可双击去除!system.out.println("页号为:t" + ins.getpageid() + "t存在&quo
10、t;);page p = pages.get(ins.getpageid();printoutinformation(p);printininformation(ins); else system.out.println("页号为:t" + ins.getpageid() + "t不存在");page p = pages.get(ins.getpageid();p.setinmen(true);page outp = pages.get(point % isuseablepageframe);p.setpageframeid(outp.getpagefr
11、ameid();p.setmodifyflag(ismodify(ins.getop();printoutinformation(outp);printininformation(ins);point+;/* * 判断指定序列是否住存传播优秀word版文档 ,希望对您有帮助,可双击去除! * * return */public boolean isexistmemeroy(instruction ins) for (int i = 0; i < this.pages.size(); i+) if (this.pages.get(i).getpageid() = ins.getpageid
12、()&& this.pages.get(i).isinmen() return true;return false;/* * 打印装载信息 * * param ins */public void printininformation(instruction ins) system.out.println("页号:" + ins.getpageid() + "tint" + "执行:"传播优秀word版文档 ,希望对您有帮助,可双击去除!+ ins.getop() + "操作t" + "物理
13、地址:"+ (1024 * ins.getpageid() + ins.getpageinaddress() + "");/* * 打印调出信息 * * param p */public void printoutinformation(page p) if (p.ismodifyflag() system.out.println("页号:" + p.getpageid() + "toutt" + "页架号:"+ p.getpageframeid() + "t修改t" + "
14、写回磁盘:"+ p.getlocationindisk() + ""); else system.out.println("页号:" + p.getpageid() + "toutt" + "页架号:"+ p.getpageframeid() + "t未修改t" + "不用写回磁盘");传播优秀word版文档 ,希望对您有帮助,可双击去除!/* * 判断指令是否修改主存内容 * * param op * return */public boolean ismodif
15、y(string op) if (op.equals("r") | op.equals("w") return true;return false;/* * return the isuseablepageframe */public int getisuseablepageframe() return isuseablepageframe;传播优秀word版文档 ,希望对您有帮助,可双击去除!/* * return the is */public linkedlist<instruction> getis() return this.is;
16、/* * return the pages */public linkedlist<page> getpages() return this.pages;/* * param is * the is to set */public void setis(linkedlist<instruction> is) this.is = is;传播优秀word版文档 ,希望对您有帮助,可双击去除!/* * param pages * the pages to set */public void setpages(linkedlist<page> pages) this
17、.pages = pages;package xiao.zhang;import xiao.zhang.bean.executefifo;import xiao.zhang.bean.instruction;import xiao.zhang.bean.page;public class mainexecute public static void main(string args) instruction i = new instruction12;i0 = new instruction("+", 0, 70);i1 = new instruction("-&
18、quot;, 1, 50);传播优秀word版文档 ,希望对您有帮助,可双击去除!i2 = new instruction("*", 2, 15);i3 = new instruction("r", 3, 21);i4 = new instruction("w", 0, 56);i5 = new instruction("-", 6, 40);i6 = new instruction("rm", 4, 53);i7 = new instruction("+", 5, 23);i8 = new instruction("w", 1, 37);i9 = new instruction("r", 2, 78);i10 = new instruc
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026及未来5年开门双四斗柜项目可行性研究报告(市场调查与数据分析)
- 6-6-6-Nitrilotris-2-naphthoic-acid-6-6-6-Nitrilotri-2-naphthoic-acid-生命科学试剂-MCE
- 5-Bis-carboxymethyl-amino-methyl-isophthalic-acid-生命科学试剂-MCE
- 天津市数学试题及答案
- 2026年厂房节能技术应用报告
- 2026年膳食补充行业研究报告:全球市场分析与本土化趋势
- 2026年体育用品行业5S管理与企业效益分析报告
- 2026年新能源行业加盟体系拓展与产业发展报告
- 2026年航空航天行业复合材料创新应用分析报告
- 高纯铟制备工艺创新研究-2026年行业报告
- 研学基地品牌推广策略
- 2025中国中信金融资产管理股份有限公司资产经营四部社会招聘笔试历年常考点试题专练附带答案详解2套试卷
- 耳穴三联疗法课件
- 涉密模块化机房施工方案
- 国内航行海船法定检验技术规则第4篇 船舶安全
- 消防过滤式自救呼吸器的使用方法杜艳葶36课件
- 中介代理公司管理制度
- 中医经络腧穴课件
- 教育研究方法第七章教育个案研究法
- 小学教学质量提升三年(2024-2027)方案及措施
- 经皮肾动脉射频消融去交感神经技术管理规范
评论
0/150
提交评论