今天把操作系统作业做完了,本来以为很简单的一个程序几十行就写完了。没想到写了有二百行,各种添加变量,各种添加if,各种添加for,直接晕菜了。 写得很乱,说不定明天就忘记写得神马意思了。先贴出来,等上机的时候在优化一下。<操作系统课程设计--短作业优先作业调度> code:
#include
#include
#include
#define MAXNUM 5
#define MAXTIME 20
struct sjf 
{
	char name[8];
	int arrivetime;
	int servicetime;
	int runtime;
	int is_over;//是否运行完
	int starttime;
	int finishtime;
	int turnaroundtime;
	float rightturnaroundtime;
}p[MAXNUM];


static int j=0,k=0,l=0;//j当前正在执行的进程	k当前时间已经到达的最大进程 l是否没有进程运行


//读取进程数据
void readProcess()
{
	int i;
	char str[200];
	FILE *fp;
	char *token;
	if ((fp=fopen("Process","rt"))==NULL)
	{
		printf("读取文件失败!\n");
		getchar();
		exit(1);
	}
	printf("|--------------------------------------|\n");
	printf("|--进程名称--|--到达时间--|--服务时间--|\n");
	for (i=0;i

            

上一篇:
下一篇:

相关文章:

Categories: 博客记录

0 Responses so far.

Leave a Reply