操作系统实验报告ccc(4)

2019-01-12 11:40

表3-2 作业的页表 页号 0 1 2 3 4 5 6 标志 1 1 1 1 0 0 0 主存块号 5 8 9 1 修改标志 0 0 0 0 0 0 0 在磁盘上的位置 011 012 013 021 022 023 121

如果该作业依次执行的指令序列如表3-3所示。

表3-3 作业依次执行的指令序列 操作 + + × 存 取 - 页号 0 1 2 3 0 6 页内地址 070 050 015 021 056 040 操作 移位 + 存 取 + 存 页号 4 5 1 2 4 6 页内地址 053 023 037 078 001 084

依次执行上述的指令序列来调试你所设计的程序(仅模拟指令的执行,不必考虑指令序列中具体操作的执行)

(5) 为了检查程序的正确性,可自行确定若干组指令序列,运行设计的程序,核对执行结果。

三、系统运行的软硬件环境(硬件配置,软件程序) Hp6460b+vc6.0 四、程序清单

#include

#include #include #define IRN 12 #define PN 7 struct IR { char op;

int pagenum; char pageadd[4]; }IR[IRN]; struct PP{

int pagenum; int f; int s; int mf;

char locate[4];

}PP[PN]; int p[4]; int k=0;

void initIR(); void initP(); void initpp(); void getIP(int i); int start; void main() {

initIR(); initP(); initpp();

printf(\请输入你想第几个指令开始:\ scanf(\ getIP(start); }

void initIR() {

IR[0].op='+'; IR[0].pagenum=0;

strcpy(IR[0].pageadd,\ IR[1].op='+'; IR[1].pagenum=1;

strcpy(IR[1].pageadd,\ IR[2].op='*'; IR[2].pagenum=2;

strcpy(IR[2].pageadd,\ IR[3].op='c'; IR[3].pagenum=3;

strcpy(IR[3].pageadd,\ IR[4].op='q'; IR[4].pagenum=0;

strcpy(IR[4].pageadd,\ IR[5].op='-'; IR[5].pagenum=6;

strcpy(IR[5].pageadd,\ IR[6].op='y'; IR[6].pagenum=4;

strcpy(IR[6].pageadd,\ IR[7].op='+'; IR[7].pagenum=5;

strcpy(IR[7].pageadd,\ IR[8].op='c';

IR[8].pagenum=1;

strcpy(IR[8].pageadd,\ IR[9].op='q'; IR[9].pagenum=2;

strcpy(IR[9].pageadd,\ IR[10].op='+'; IR[10].pagenum=4;

strcpy(IR[10].pageadd,\ IR[11].op='c'; IR[11].pagenum=6;

strcpy(IR[11].pageadd,\ }

void initP(){

PP[0].pagenum=0; PP[0].f=1; PP[0].s=5; PP[0].mf=0;

strcpy(PP[0].locate,\ PP[1].pagenum=1; PP[1].f=1; PP[1].s=8; PP[1].mf=0;

strcpy(PP[1].locate,\ PP[2].pagenum=2; PP[2].f=1; PP[2].s=9; PP[2].mf=0;

strcpy(PP[2].locate,\ PP[3].pagenum=3; PP[3].f=1; PP[3].s=1; PP[3].mf=0;

strcpy(PP[3].locate,\ PP[4].pagenum=4; PP[4].f=0; PP[4].mf=0;

strcpy(PP[4].locate,\ PP[5].pagenum=5; PP[5].f=0; PP[5].mf=0;

strcpy(PP[5].locate,\ PP[6].pagenum=6; PP[6].f=0; PP[6].mf=0;

strcpy(PP[6].locate,\}

void initpp(){ int i;

for(i=0;i<4;i++) p[i]=i; }

void getIP(int i) {

int l;

l=IR[i].pagenum; if(PP[l].f==1){ char str[7];

strcpy(str,PP[l].locate); strcat(str,IR[i].pageadd); if(IR[i].op=='c'){ PP[l].mf=1;

printf(\块号:%d \ printf(\ } else{

printf(\块号:%d \ printf(\ }

if(i+1==12){

printf(\指令取完!结束!\ } else

getIP(++i); } else{

int j,m;

printf(\产生中断!%d页页号\\n\ j=p[k];

if(PP[j].mf==1){

printf(\ printf(\ } else{

printf(\ }

m=p[k]; p[k]=l; k=(k+1)%4;

}

}

PP[m].f=0; PP[m].mf=0; PP[l].f=1;

PP[l].s=PP[m].s; if(IR[i].op=='c') PP[l].mf=1; if(i+1==12){

printf(\指令取完!结束!\\n\} else

getIP(++i);

五、实验结果与分析


操作系统实验报告ccc(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:雅思听力考试的图画题的解题技巧

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: