ID<<""<priority<<""<CPUtime<<""<A" /> ID<<""<priority<<""<CPUtime<<""<A" />

全文预览

进程调度算法__操作系统课程设计

上传者:徐小白 |  格式:doc  |  页数:25 |  大小:0KB

文档介绍
urn0;}}///////输出所有PCB的初始值voidprint_init(PCB*pcb){PCB*temp=pcb->next;cout<<("\nIDpriorityCPUtimeALLtimeState");while(temp!=NULL){cout<<"\n"<<temp->ID<<""<<temp->priority<<""<<temp->CPUtime<<""<<temp->ALLtime;if(temp->State==0)cout<<("ready");elseif(temp->State==1)cout<<("running");elsecout<<("blocked");temp=temp->next;}}///////输出进程属性信息voidprint(PCB*pcb){PCB*temp;temp=pcb;if(pcb->ID==0)cout<<("\nTheidlepeocessidrunning!");else{cout<<"\n"<<temp->ID<<""<<temp->priority<<""<<temp->CPUtime<<""<<temp->ALLtime;if(temp->State==0)cout<<("ready");elseif(temp->State==1)cout<<("running");elsecout<<("blocked");}}///////将item插入到队列中,使得插入后,队列中按照优先级从高到低有序voidinsert_queue(PCB*queue,PCB*item){PCB*p,*q;q=queue;p=q->next;while(p!=0&&p->priority>=item->priority){q=p;p=p->next;}if(p==0){item->next=0;q->next=item;

收藏

分享

举报
下载此文档