91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

本文件是對操作系統作業調度算法中的最高響應比優先算法的設計與實現,代碼和報告都放在了壓縮文件中,代碼使用的文件輸入輸出。

資源截圖

代碼片段和文件信息

#include
#include
#include
using?namespace?std;
struct?JJob{
????int?id;??????????//作業id號
????int?run_time;????//作業需要完成運行時間
????int?come_time;????//作業提交時間
????int?wait_time;???//作業等待時間
????int?end_time;????//進程運行結束時間
}Job[10];




int??input()
??{
????int?shuru;
???cout<<“please?input‘1‘the?program?will?read?the?data?from?the?file?‘input.txt‘or?input?other?number?to?terminate?it.“<???cin>>shuru;
???if(shuru==1){
???string?line;
???ifstream?openfile(“input.txt“);
???int?head=0q=0;
???while(getline(openfileline))
???{
?????istringstream?is(line);
?????if(head==0){
????????head=1;
????????continue;
????????}
????????is>>Job[q].id>>Job[q].come_time>>Job[q].run_time;
????????//cout<????????q++;
????}
????openfile.close();
????cout<<“read?data?from?the?file?successfully!“<????return?1;
???}
???else
????return?0;
??}




??int?output(){
??????ofstream?output(“output.txt“);
??????return?0;
???}




??int?suanfa()
??{
????int?Job_num=5;
????int?a;
????a=input();
????output();
????if(a==0)
????????return?0;
????ofstream?output(“output.txt“);
????Job[0].wait_time=0;
????Job[0].end_time=Job[0].come_time+Job[0].run_time;
????cout<????output<????int?m=0n=0;
????for(int?j=1;j????int?p=0;
????double?rprpmax=0;???//響應比和響應比最大值
????for(int?i=1;i????????if(Job[i].end_time==0){????//結束時間不等于0的作業全部已經運行過
???????????if(Job[i].come_time??????????????p++;
??????????????Job[i].wait_time=Job[m].end_time-Job[i].come_time;
??????????????rp=(Job[i].wait_time+Job[i].run_time)/double(Job[i].run_time);
??????????????if(rpmax????????????????n=i;
????????????????rpmax=rp;
??????????????}
???????????}
????????}
????}
????if(p==0){
????????for(int?i=1;i????????if(Job[i].end_time==0){
????????????n=i;
????????????break;
????????}
????????}
????}
????Job[n].end_time=Job[n].wait_time+Job[n].come_time+Job[n].run_time;
????cout<????output<????m=n;
????}
????return?0;
??}

















?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????646752??2017-12-14?15:33??最高響應比優先算法\bin\Debug\zuoye2.exe

?????文件????????192??2017-12-14?14:45??最高響應比優先算法\input.txt

?????文件???????2389??2017-12-14?15:24??最高響應比優先算法\jiekou.cpp

?????文件????????142??2017-12-14?15:33??最高響應比優先算法\job.h

?????文件????????127??2017-12-14?15:26??最高響應比優先算法\main.cpp

?????文件?????496699??2017-12-14?14:16??最高響應比優先算法\main.exe

?????文件???????3173??2017-12-14?14:16??最高響應比優先算法\main.o

?????文件?????124085??2017-12-14?15:24??最高響應比優先算法\obj\Debug\jiekou.o

?????文件?????114025??2017-12-14?15:33??最高響應比優先算法\obj\Debug\main.o

?????文件??????????0??2017-12-14?17:29??最高響應比優先算法\output.txt

?????文件??????????2??2017-12-09?21:15??最高響應比優先算法\Untitled1.c

?????文件???????1096??2017-12-14?17:43??最高響應比優先算法\zuoye2.cbp

?????文件????????312??2017-12-14?15:33??最高響應比優先算法\zuoye2.depend

?????文件????????720??2017-12-14?17:43??最高響應比優先算法\zuoye2.layout

?????文件??????61451??2017-12-14?17:38??最高響應比優先算法\實驗2?最高響應比優先.docx

?????目錄??????????0??2017-12-14?15:33??最高響應比優先算法\bin\Debug

?????目錄??????????0??2017-12-14?15:33??最高響應比優先算法\obj\Debug

?????目錄??????????0??2017-12-09?20:08??最高響應比優先算法\bin

?????目錄??????????0??2017-12-09?20:08??最高響應比優先算法\obj

?????目錄??????????0??2017-12-14?17:43??最高響應比優先算法

-----------?---------??----------?-----??----

??????????????1451165????????????????????20


評論

共有 條評論