fifo.h

来自「操作系统的一些实验」· C头文件 代码 · 共 44 行

H
44
字号
#ifndef FIFO_H
#define FIFO_H

#include "fs.h"

void FIFO(total_pf)
	int total_pf;
{
	int i,j;
	pfc_type *p,*t;
	initialize(total_pf);
	busypf_head=busypf_tail=NULL;
	for(i=0; i<total_instruction; i++)
	{
		if(pl[page[i]].pfn==INVALID)
		{
			diseffect+=1;
			if(freepf_head==NULL)
			{
				p=busypf_head->next;
				pl[busypf_head->pn].pfn=INVALID;
				freepf_head=busypf_head;
				freepf_head->next=NULL;
				busypf_head=p;
			}
			p=freepf_head->next;
			freepf_head->next=NULL;
			freepf_head->pn=page[i];
			pl[page[i]].pfn=freepf_head->pfn;
			if(busypf_tail==NULL)
				busypf_head=busypf_tail=freepf_head;
			else
			{
				busypf_tail->next=freepf_head;
				busypf_tail=freepf_head;
			}
			freepf_head=p;
		}
	}
	printf("FIFO:%6.4f",i-(float)diseffect/320);
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?