资源简介
本文件是对操作系统作业调度算法中的最高响应比优先算法的设计与实现,代码和报告都放在了压缩文件中,代码使用的文件输入输出。

代码片段和文件信息
#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 最高响应比优先算法\Unti
文件 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
- 上一篇:多级反馈队列调度算法实现
- 下一篇:Super vlan
相关资源
- SVR算法程序可运行
- 计算机图形学 边填充算法实现代码
- 升腾Win终端系统升级方法新版.doc
- Uninstall_Cortana_WINCLIENT.CN.rar
- 福建师范大学历年算法考卷
- 栈的实现及应用,六种基本算法
- Bresenham算法绘制线段并利用“橡皮筋
- 介绍几种压缩算法及《笨笨数据压缩
- 改进的BP神经网络算法
- STM32基于rt_thread操作系统的SDHC卡文件
- A星算法_原理讲解_例子
- 云模型的相关算法cloud
- 旋转矩阵求欧拉角的简单算法
- 栅栏填充算法源码(VC)
- RSA算法源码
- 关联分析Apriori算法实现
- [免费]relax算法成像
- 操作系统 LRU算法 实验报告 及 程序代
- [免费]车载CE6.0操作系统
- 分治法快速排序算法QuickSort C
- 分页系统模拟实验 操作系统 课程设
- 现代谱估计算法 music ESPRIT 谐波分解
- MUSIC算法c 实现
- 模拟段页式虚拟存储管理中地址转换
- 007出纳管理系统 v7[1].5.94 算法注册机
- 克鲁斯卡尔算法C和C 实现代码
- capon波束形成算法-VC实现
- 操作系统实验——虚存管理实验
- 广工操作系统实验
- QGA 量子遗传算法
评论
共有 条评论