⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schedule.cpp

📁 操作系统的页面调度算法
💻 CPP
字号:
// schedule.cpp: implementation of the schedule class.
//
//////////////////////////////////////////////////////////////////////

#include "schedule.h"
#include<fstream.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

schedule::schedule(char *fn)
{
	T=W=0;
	ifstream in("fn");
	int start,cost;
	if(!in){
	  cout<<"Can not open file!\n";	  
	}
	while(!in.fail())	
	{		
		in>>start>>cost;
		process* p=new process(start,cost);
		Quesche.insert(p);	
		Quesche.length++;
	}
}

void schedule::FCFS(void)
{
	process* p=Quesche.head;
	process* q=p->next;
	while(q!=NULL)
	{
		q->begin_executetime=p->finishtime;
		q->finishtime=q->begin_executetime+q->costtime;
		q->finish=true;
		q->perT=q->finishtime-q->arrtime;
		q->perW=q->perT/q->costtime;
		T=T+q->perT;
		W=W+q->perW;
		p=q;
		q=q->next;
	}
	T=T/Quesche.length;
	W=W/Quesche.length;
}


void schedule::SJF(void)
{
	
}
schedule::~schedule()
{

}

⌨️ 快捷键说明

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