计算机操作系统课程设计源代码《通用处理机调度演示程序源代码》 下载本文

}

printf(\输入文件路径:\scanf(\fp=fopen(filePath,\times=timeOfData(fp); ProcessAmount=times-2; while(i

fclose(fp);

if(i==0){ //这是用来接收文本格式第一行的汉字。

fscanf(fp,\fscanf(fp,\fscanf(fp,\fscanf(fp,\

//以下用来接收进程数据

}else{ } i++;

fscanf(fp,\fscanf(fp,\fscanf(fp,\fscanf(fp,\

setNewPCB(name,pri,emt,st);

void setNewPCB(char *name,int pri,int entime,int sertime){//赋值建立PCB,用于从文本中获取数据

if(head==NULL){

head=newP;

newP=(struct PCB1 *)malloc(sizeof(struct PCB1));

}else{

thisP=head;

while(thisP->next!=NULL){

thisP=thisP->next;

}

}

}

thisP->next=newP;

thisP=newP;

thisP->No=SequenceNumber; SequenceNumber++; strcpy(thisP->name,name); thisP->priority=pri;

thisP->enterMemoryTime=entime; thisP->serviceTime=sertime;

thisP->next=NULL;

int timeOfData(FILE *f){ //求取从文本中获取数据的进程数量 }

void Menu(){

int flag=1; int se; while(flag){

//菜单

char temp[20]; int i=0; if(f==NULL){

printf(\文件没有找到。\\n\exit(0);

}else{ }

rewind(f); return i;

while(fgets(temp,20,f)!=NULL){ }

i++;

printf(\ --------------12软工3班 陈宇锋 谈泽宇------------\\n\

printf(\ -- 静态优先权优先算法进程调度

--\\n\

printf(\ ----------------------------------------------\\n\ }

//高响应比调度算法 int N;

struct zgxyb *c; struct zgxyb{

}

printf(\进程调度模拟\\n\printf(\退出\\n\printf(\请选择:\scanf(\fflush(stdin); switch(se){ }

SequenceNumber=1; StartCount=0;

case 1:{ }

break;

buildProcess(); printf(\进程列表:\ListAllPCB(head); run();

//清空缓冲区,用于解决输入字符串发生死循环的问题

case 0:

flag=0; break;

default:

printf(\请输入正确选项。\\n\\n\break;

char name[10]; float arrivetime; float servicetime; float starttime; float finishtime; float zztime; float dqzztime; };

struct zgxyb a[100];

void input(struct zgxyb *p,int N) { int i;

printf(\请分别输入 进程名 到达时间 要求服务时间:\\n例如: a 0 100\\n\for(i=0;i<=N-1;i++) {

printf(\请输入第%d个的进程信息:\\n\

scanf(\} }

void Print(struct zgxyb *p,float arrivetime,float servicetime,float starttime,float finishtime,float zztime,float dqzztime,int N) {int k;

printf(\ printf(\for(k=1;k

{printf(\}

printf(\当前执行进程信息:\\n\

printf(\进程名 到达时间 服务时间 开始执行时间 完成时间 周转时间 带权周转时间\\n\

for(k=0;k<=N-1;k++)

{ printf(\etime,p[k].servicetime,p[k].starttime,p[k].finishtime,p[k].zztime,p[k].dqzztime); }