#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void Check();
typedef struct node
{
char name[10];
int span;//轮转时间
int take;//占用时间
int used;//已用的时间
int need;//还需要的时间
char status;//状态
struct node *next;
}PCB;
PCB *ready,*finish,*tail,*rear;
void Print(PCB *p)
{
while(p!=NULL)
{
printf("%3s%5d%5d%5d%5d%5c\n",p->name,p->used,p->need,p->take,p->span,p->status);
p=p->next;
}
}
void Creat(int N)
{
PCB *p;
int time;
char na[10];
ready=NULL; /*就绪队列头指针*/
finish=NULL; /*完成队列头指针*/
tail=NULL;
rear=NULL;
int i;
printf("Enter name and time of round process \n");
for(i=1;i<=N;i++)//创建就绪队列
{
p=(PCB *)malloc(sizeof(PCB));
scanf("%s",na);
scanf("%d",&time);
strcpy(p->name,na);
p->span=2;
p->take=0;
p->used=0;
p->need&
时间片轮转调度算法
最新推荐文章于 2024-10-17 10:52:26 发布