ructprocess1*head,structprocess1*s);/*******************优先权调度算法所需函数*****************************************************/structprocess1*creatlist1(intn){srand((int)time(0));structprocess1*first=newprocess1;first->next=NULL;for(inti=0;i<n;i++){structprocess1*s;s=newprocess1;s->pcb=i;s->privilege=random(20)+5;s->cpu=random(20)+1;insert1(first,s);}returnfirst;}voidinsert1(structprocess1*first,structprocess1*s)//插入节点{structprocess1*p=search(first,s);s->next=p->next;p->next=s;//return;}structprocess1*search(structprocess1*first,structprocess1*s)//查找第一个到达时间大于等于AT的节点,返回其前一个指针{structprocess1*p,*q;p=first;q=first->next;while(q!=NULL&&q->privilege>=s->privilege){p=q;q=q->next;}returnp;}voiddel1(structprocess1*first,structprocess1*s){structprocess1*p,*r;p=first->next;r=first;inta=1;while(a){if(p==s){