#include<stdio.h>
#include<stdlib.h>
#define NUM 10
typedef struct PCB
{
int name;//进程id
int runtime;//剩余需要执行的时间,可随机分配
int runedtime;//已经执行的时间
int state;//执行状态,0表示没完成,1表示完成
struct PCB *next;
}PCB;
int main()
{
int timeslice=3;
PCB *runqueue,*p;
PCB *top,*tail,*temp;//队列指针
int i;
int count=10;
top = tail= (struct PCB*)malloc(sizeof(struct PCB));
top ->next=NULL;
runqueue=top;
printf("********进程初始状态******\n");
for(i=0;i<NUM;i++)
{
runqueue ->next= (struct PCB*)malloc(sizeof(struct PCB));
runqueue = runqueue->next;
tail=runqueue;
runqueue ->name=i+1;