cout<<":
";
}
for(intr=1;r<=n;r++)t[r]=0;
flag=0;
}
cout<<"缺页中断数为:
"<cout<<"w="<delete[]a;
}
main()
{
intm,n;
cout<<"输入页面数:
"<cin>>m;
int*a=newint[m+1];
cout<<"输入驻留集大小:
"<cin>>n;
cout<<"inputthepages"<for(inti=1;i<=m;i++)
cin>>a[i];
cout<cout<<"TheresultofFIFO:
"<FIFO(a,n,m);
cout<cout<<"TheresultofLRU:
"<LRU(a,n,m);
cout<cout<<"TheresultofOPT:
"<OPT(a,n,m);
cout<return0;
delete[]a;
}
模拟FIFO页面调度算法处理缺页中断
2009-11-2816:
14
模拟FIFO页面调度算法处理缺页中断
#include
#include
classList;
classitem
{
public:
friendclassList;
private:
item(intp=0,ints=0,intb=0,intl=0,intc=0){page=p;sign=s;block=b;locate=l;changesign=c;next=NULL;}
item*next;
intpage;
intsign;
intchangesign;
intblock;
intlocate;
};
classList
{
public:
List(intp=0,ints=0,intb=0,intl=0,intc=0){list=newitem(p,s,b,l,c);}
intcheck(intp);
intinsert(intp,ints,intb,intl);
void