#include
#include
typedef struct PCB{
int PID;
char state;
int priority;
int runTime;
int workTime;
struct PCB *next;
}*process,ptr;
PCB *ready=NULL,*p;
int num;
void PCBsort(){
PCB *first,*second;
int flag=0;
if((ready==NULL)||((p->priority)priority))){
p->next=ready;
ready = p;
}else{
first=ready;
second=first->next;
while(second!=NULL){
if((p->priority)priority)){
p->next=second;
first->next=p;
second=NULL;
flag=1;
}else{
first=first->next;
second=second->next;
}
}
if(flag==0)first->next=p;
}
}</