欢迎来到天天文库
浏览记录
ID:51278323
大小:250.23 KB
页数:12页
时间:2020-03-21
《模拟操作系统的请求分页存储管理java代码.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、请求分页存储管理的实现写出方案实现代码(1)page类packagehomework;publicclassPage{privateintpagenumb;//页号privateintphysicsnumb;//物理块号privatebooleanstate;//状态位privateintvisitcount;//访问字段privatebooleanchange;//修改位privateintCRTaddress;//外存地址publicPage(){this.pagenumb=-1;this.physicsn
2、umb=-1;this.state=false;this.visitcount=0;this.change=false;this.CRTaddress=-1;}publicPage(intpagenumb,intphysicsnumb,booleanstate,intvisitcount,booleanchange,intCRTaddress){this.pagenumb=pagenumb;this.physicsnumb=physicsnumb;this.state=state;this.visitcount
3、=visitcount;this.change=change;this.CRTaddress=CRTaddress;}publicvoidsetPagenumb(intpagenumb){this.pagenumb=pagenumb;}publicvoidsetPhysicsnumb(intphysicsnumb){this.physicsnumb=physicsnumb;}publicvoidsetState(booleanstate){this.state=state;}publicvoidsetVisit
4、count(intvisitcount){this.visitcount=visitcount;}publicvoidsetChange(booleanchange){this.change=change;}publicvoidsetCRTaddress(intCRTaddress){this.CRTaddress=CRTaddress;}publicintgetPagenumb(){returnthis.pagenumb;}publicintgetPhysicsnumb(){returnthis.physic
5、snumb;}publicbooleangetState(){returnthis.state;}publicintgetVisitcount(){returnthis.visitcount;}publicbooleangetChange(){returnthis.change;}publicintgetCRTaddress(){returnthis.CRTaddress;}}(2)Shell类:页表packagehomework;importjava.util.Scanner;publicclassShell
6、{Pageshell[];privateintcurrent;privateintlength;publicShell(){};publicShell(intlength){this.length=length;this.current=0;shell=newPage[length];for(inti=0;i7、getCurrent(){returnthis.current;}publicintsearchpage(intpagenumb){inti=0;if(this.current==0){return-2;}else{while(i8、nner(System.in);switch(ch){case"yes":{System.out.println("请输入一个新的数据");b[this.shell[number].getPhysicsnumb()]=a.nextInt();this.shell[number].setChange(true);System.out.println("修改成功!");break;}cas
7、getCurrent(){returnthis.current;}publicintsearchpage(intpagenumb){inti=0;if(this.current==0){return-2;}else{while(i8、nner(System.in);switch(ch){case"yes":{System.out.println("请输入一个新的数据");b[this.shell[number].getPhysicsnumb()]=a.nextInt();this.shell[number].setChange(true);System.out.println("修改成功!");break;}cas
8、nner(System.in);switch(ch){case"yes":{System.out.println("请输入一个新的数据");b[this.shell[number].getPhysicsnumb()]=a.nextInt();this.shell[number].setChange(true);System.out.println("修改成功!");break;}cas
此文档下载收益归作者所有