模拟进程执行过程
typedef struct process datatype;struct process{char name[20];
struct process *next;
int time;
char state[20];
int pri;};
typedef struct link{struct process *front;
struct process *rear;}Link Queue;
void InitQueue(Link Queue *Q)
{Q->front=Q->rear=Null;}
int QueueEmpty(Link Queue *Q)
{return Q->front==Null&&Q->rear==Null;}
void EnQueue(LinkQueue *Q,DataType x)
{Queue.node *p=(Queuenode*)malloc(sizeof(Queuenode));
p->data=x;p->next=Null;
if(QueueEmpty(Q)) Q->front=Q->Q->rear=p;
eles{Q->rear->next=p;Q->rear=p;
}
DataType DeQueue(LinkQueue *Q)
{DataType x;
Queuenode *p;
if(QueueEmpty(Q) Error("Queue nuderflow");
p=Q->front;
x=p->data;
Q->front=p->next;
if(Q->rear==p)
Q->rear=Null;
free(p);
return x;}
#include<stdio.h>
void main()
{struct process p[5]={(p1,0,2,1,ready),(p2,k4,3,5,ready),(p3,k5,1,3,ready),(p4,k3,2,4,ready),(p5,k1,4,2,ready)}};