实验五 进程调度模拟实验//进程调度算法 proc
c#include #include#include typedef struct pcb//定义 PCB 结构{char name[20]; /*进程标识符*/int cputime; /*进程占用 CPU 时间*/int prio; /*进程优先数*/int needtime; /*进程到完成还需要的 CPU 时间*/struct pcb *next;/*链指针*/}PCB;PCB *RUN,*READY,*RTAIL,*FINSH,*FTAIL;void PRINTLINK(int t)/*输出 3 个队列*/{PCB *p;printf("CPU 运行次数:___%d___\n",t);printf("______________________\n");printf("进程名\t 运行状态\t 运行次数\t 还需要运行次数\n");if(RUN
=NULL){ printf("%s\t 运行\t%d\t%d\n",RUN->name,RUN->cputime,RUN->needtime); }else printf("*运行状态为空\n");p=READY;if(p
=NULL){ while(p
=NULL) {printf("%s\t 就绪\t%d\t%d\n",p->name,p->cputime,p->needtime); p=p->next; } }else printf("*就绪队列为空\n");p=FINSH;if (p
=NULL){ while(p
=NULL){//printf(" 进程名字为:%s\n",p->name);printf("%s\t 完成\t%d\t%d\n",p->name,p->cputime,p->needtime);p=p->next;}}elseprintf("*完成