欢迎来到天天文库
浏览记录
ID:38923851
大小:250.23 KB
页数:12页
时间:2019-06-21
《模拟操作系统的请求分页存储管理java代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、请求分页存储管理的实现写出方案实现代码(1)page类packagehomework;publicclassPage{privateintpagenumb;//页号privateintphysicsnumb;//物理块号privatebooleanstate;//状态位privateintvisitcount;//访问字段privatebooleanchange;//修改位privateintCRTaddress;//外存地址publicPage(){this.pagenumb=-1;this.physicsnumb=-1;this.state=false;this.visitcount=0;
2、this.change=false;this.CRTaddress=-1;}publicPage(intpagenumb,intphysicsnumb,booleanstate,intvisitcount,booleanchange,intCRTaddress){this.pagenumb=pagenumb;this.physicsnumb=physicsnumb;this.state=state;this.visitcount=visitcount;this.change=change;this.CRTaddress=CRTaddress;}publicvoidsetPagenumb(int
3、pagenumb){this.pagenumb=pagenumb;}publicvoidsetPhysicsnumb(intphysicsnumb){this.physicsnumb=physicsnumb;}publicvoidsetState(booleanstate){this.state=state;}publicvoidsetVisitcount(intvisitcount){this.visitcount=visitcount;}publicvoidsetChange(booleanchange){this.change=change;}publicvoidsetCRTaddres
4、s(intCRTaddress){this.CRTaddress=CRTaddress;}publicintgetPagenumb(){returnthis.pagenumb;}publicintgetPhysicsnumb(){returnthis.physicsnumb;}publicbooleangetState(){returnthis.state;}publicintgetVisitcount(){returnthis.visitcount;}publicbooleangetChange(){returnthis.change;}publicintgetCRTaddress(){re
5、turnthis.CRTaddress;}}(2)Shell类:页表packagehomework;importjava.util.Scanner;publicclassShell{Pageshell[];privateintcurrent;privateintlength;publicShell(){};publicShell(intlength){this.length=length;this.current=0;shell=newPage[length];for(inti=0;i6、rent(intcurrent){this.current=current;}publicintgetCurrent(){returnthis.current;}publicintsearchpage(intpagenumb){inti=0;if(this.current==0){return-2;}else{while(i7、newScanner(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
6、rent(intcurrent){this.current=current;}publicintgetCurrent(){returnthis.current;}publicintsearchpage(intpagenumb){inti=0;if(this.current==0){return-2;}else{while(i7、newScanner(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、newScanner(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
此文档下载收益归作者所有