實(shí)驗(yàn)說(shuō)明:FZU的操作系統(tǒng)課程的實(shí)驗(yàn)一
創(chuàng)新互聯(lián)專注于企業(yè)成都營(yíng)銷網(wǎng)站建設(shè)、網(wǎng)站重做改版、鄒平網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5場(chǎng)景定制、商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為鄒平等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。
實(shí)驗(yàn)?zāi)康?/p>
實(shí)驗(yàn)內(nèi)容
實(shí)驗(yàn)要求
流程圖
下面是C語(yǔ)言代碼(個(gè)人所做,不保證完美無(wú)漏洞,僅供參考,杜絕無(wú)腦照搬)【游客代碼】,→點(diǎn)此處前往查看詳解代碼←
#include#includetypedef struct oo0o{int o0oo;
int o0o0;
char o000[20];
int lll1;
}oo00;
typedef struct ll11 * ll1l;
typedef struct ll11{ll1l l1ll;
oo00 * o00o;
}ll11;
int main(){int ooo0;
int oooo;
ll1l llll;
printf("\n請(qǐng)輸入進(jìn)程總個(gè)數(shù)?");
scanf("%d",&ooo0);
oo00 l11l[ooo0];
ll1l l1l1 =(ll1l)malloc (sizeof (ll11));
l1l1->l1ll = NULL;
l1l1->o00o = NULL;
printf("\n已創(chuàng)建進(jìn)程數(shù)為%d信息的空間",ooo0);
int l111=0;
while(l111++printf("\n\n進(jìn)程號(hào)No.%d:\n\n輸入進(jìn)程名(長(zhǎng)度為20的字符內(nèi)):",l111-1);
scanf("%s",&l11l[l111-1].o000);
printf("\n輸入進(jìn)程優(yōu)先數(shù)(0~99):");
scanf("%d",&l11l[l111-1].o0o0);
printf("\n輸入進(jìn)程運(yùn)行時(shí)間(自然數(shù)):");
scanf("%d",&l11l[l111-1].o0oo);
l11l[l111-1].lll1 = 0;
oooo+=l11l[l111-1].o0oo;
ll1l gg9g = (ll1l)malloc (sizeof (ll11));
llll = l1l1;
gg9g->l1ll = NULL;
gg9g->o00o = &l11l[l111-1];
if(llll->o00o == NULL){ llll->l1ll = gg9g->l1ll;
llll->o00o = gg9g->o00o;
}
else{ ll1l ggg9 = NULL;
int gg99 = 0;
for(llll= l1l1;llll;ggg9=llll,llll = llll->l1ll){ if(llll->o00o->o0o0 >= l11l[l111-1].o0o0)continue;
if(ggg9 == NULL){gg9g->l1ll=l1l1;
l1l1=gg9g;
}
else{gg9g->l1ll = ggg9->l1ll;
ggg9->l1ll=gg9g;
}
gg99 = 1;
break;
}
if(gg99 == 0){ gg9g->l1ll = ggg9->l1ll;
ggg9->l1ll=gg9g;
}
}
}
printf("\n");
l111 = 0;
llll=l1l1;
while(l111++printf("\n輸入任意按鍵繼續(xù)...");
getch();
printf("\n *-*-*-*-*-*-*-* The execute number: %d *-*-*-*-*-*-*-\n",l111);
printf("\n *-*-*-*-* 當(dāng)前正在運(yùn)行的進(jìn)程是: %s *-*-*-*-*\n",llll->o00o->o000);
printf("p_name\tstate\tsuper\tndtime\truntime\n");
printf("%s\t%s\t%d\t%d\t%d\n",llll->o00o->o000,"R",llll->o00o->o0o0,llll->o00o->o0oo,llll->o00o->lll1);
ll1l gggg = llll;
printf("\n *-*-*-*-* 當(dāng)前就緒隊(duì)列狀態(tài)為: *-*-*-*-*\n");
for(gggg=gggg->l1ll;gggg;gggg=gggg->l1ll){ printf("\np_name\tstate\tsuper\tndtime\truntime\n");
printf("%s\t%s\t%d\t%d\t%d\n",gggg->o00o->o000,"w",gggg->o00o->o0o0,gggg->o00o->o0oo,gggg->o00o->lll1);
}
if(llll->o00o->o0o0>0)llll->o00o->o0o0--;
llll->o00o->lll1++;
if(llll->o00o->lll1 == llll->o00o->o0oo){ printf("\n時(shí)間片到期,此時(shí)進(jìn)程 [%s] 已完成.",llll->o00o->o000);
gggg=llll;
llll=llll->l1ll;
free(gggg);
}
else{ if(llll->l1ll){ gggg=llll;
ll1l ggg9 = NULL;
llll=llll->l1ll;
ll1l ll;
int gg99 = 0;
for(ll=llll;ll;ggg9=ll,ll = ll->l1ll){if(ll->o00o->o0o0 >= gggg->o00o->o0o0)continue;
if(ggg9 == NULL){gggg->l1ll=llll;
llll=gggg;
}
else{gggg->l1ll = ggg9->l1ll;
ggg9->l1ll=gggg;
}
gg99 = 1;
break;
}
if(gg99 == 0){gggg->l1ll = ggg9->l1ll;
ggg9->l1ll=gggg;
}
}
}
}
if(ooo0>0){printf("\n\n\n進(jìn)程已全部完成.\n");
getch();
}
return 0;
}
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級(jí)服務(wù)器適合批量采購(gòu),新人活動(dòng)首月15元起,快前往官網(wǎng)查看詳情吧