实验指导
任务:设计一个虚拟存储区和内存工作区,并使用下述算法计算访问命中率。
(1)先进先出算法(FIFO)
(2)最近最少使用算法(LRU)
(3)最佳淘汰算法(OPT)
(4)最少访问页面算法(LFU)
(5)最近最不经常使用算法(NUR)
命中率=(1-页面失效次数)/页地址流长度
1、数据结构
(1)页面类型
typedef struct{
int pn,pfn,counter,time;
}pl_type;
其中 pn 为页号,pfn 为面号,counter 为一个周期内访问该页面次数,time 为访
问时间。
(2)页面控制结构
struct pfc_struct{
int pn,pfn;
struct pfc-struct *next;};
typedef struct pfc_struct pfc_type;
pfc_type pfc[total_vp],*freepf_head,*busypf_head,*busypf_tail;
评论0