请求调页存储管理方式的模拟NRU.doc

请求调页存储管理方式的模拟NRU.doc

ID:51840465

大小:19.24 KB

页数:5页

时间:2020-03-16

请求调页存储管理方式的模拟NRU.doc_第1页
请求调页存储管理方式的模拟NRU.doc_第2页
请求调页存储管理方式的模拟NRU.doc_第3页
请求调页存储管理方式的模拟NRU.doc_第4页
请求调页存储管理方式的模拟NRU.doc_第5页
资源描述:

《请求调页存储管理方式的模拟NRU.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、...... #include  #include  #include  #ifndef _UNISTD_H #define _UNISTD_H #include  #include  #endif  #define TRUE 1 #define FALSE 0 #define INVALID -1 #define NULL 0  #define  total_instruction 320 /*指令流长*/ #define total

2、_vp 32 /*虚页长*/ #define clear_period 50 /*清0周期*/  typedef struct /*页面结构*/ { int pn,pfn,counter,time; }pl_type; pl_type pl[total_vp]; /*页面结构数组*/ struct pfc_struct{                  /*页面控制结构*/  int pn,pfn;  struct pfc_struct *next; };  typedef struct pfc_struct pfc_typ

3、e;  pfc_type pfc[total_vp],*freepf_head,*busypf_head,*busypf_tail;  int diseffect,  a[total_instruction]; int page[total_instruction],  offset[total_instruction];  intinitialize(int);intNUR(int) int main( ) {  int s,i,j; srand(10*getpid()); /*由于每次运行时进程号不同,故可用来作为初始化随

4、机数队列的“种子”*/ s=(float)319*rand( )/32767/32767/2+1; // .专业资料.......for(i=0;i

5、

6、s>319)  { printf("When i==%d,Error,s==%d",i,s);  exit(0); }  a[i]=s;  /*任选一指令访问点m*/  a[i+1]=a[i]+1; /*顺序执行一条指令*/  a[i+2]=(float)a[i]*rand( )/327

7、67/32767/2; /*执行前地址指令m' */ a[i+3]=a[i+2]+1; /*顺序执行一条指令*/  s=(float)(318-a[i+2])*rand( )/32767/32767/2+a[i+2]+2; if((a[i+2]>318)

8、

9、(s>319))  printf("a[%d+2],a number which is :%d and s==%d",i,a[i+2],s);  } for (i=0;i

10、=a[i]/10;  offset[i]=a[i]%10; } for(i=4;i<=32;i++) /*用户内存工作区从4个页面到32个页面*/ { printf("---%2d page frames---",i); NUR(i);  }  return 0; }  int initialize(total_pf) /*初始化相关数据结构*/ int total_pf; /*用户进程的内存页面数*/ {int i; diseffect=0; for(i=0;i

11、pl[i].pfn=INVALID; /*置页面控制结构中的页号,页面为空*/  pl[i].counter=0;  pl[i].time=-1; /*页面控制结构中的访问次数为0,时间为-1*/ } for(i=0;i

12、; freepf_head=&pfc[0]; /*空页面队列的头指针为pfc[0]*/ return 0; }   int NUR(total_pf) /*最近未使用算法*/ int total_pf; {int i,j,dp,cont_flag,old_dp; pfc_ty

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。