页式虚拟存储管理
}
}
}
void changeLRU(int n)
{
int i=0;
int flag=1;
page *p,*delect;
p=head->next;
while(p)
{
if(p->address==0)
{
flag=0;
p->address=n;
printf("Change the page %d\n",i+1);
break;
}
p=p->next;
i++;
}
if(flag)
{
delect=head->next;
head->next=delect->next;
printf("Delect from the head, and add new to the end.\n"); delect->address=n;
rear->next=delect;
rear=delect;
rear->next=NULL;
}
}
float OPT()
{
int i;
int lose=0;
float losef;
float percent;
for(i=0;i<N;i++)
{
if(search(A[i])==0)
{
lose++;
changeOPT(A[i],i);