分类:
2005-10-24 20:25:13
/*FIFO置换算法模拟*/
#include
#define m 12
#define n 4
main()
{
int i,j,k,p=0;
float count=n;
char a[m],b[n],c[m];
printf("input the %d jobs
",m);
scanf("%s",a);
for(i=0;i
for(i=n;i
while(j
else j++;
}
if(j==n)
{count++;
c[p++]=b[i];
for(k=1;k
b[n-1]=a[i];
}
}
printf("the jobs that remain in the system is:
");
for(i=0;i
printf("
There are %f times interput the system
",count);
printf("缺页中断率为%f%c
",count/m*100.0,'%');
printf("淘汰的页面的顺序是:
");
for(i=0;i printf("%3c",c[i]);
}