操作系统原理 实验1、2

这篇博客探讨了操作系统中的两种进程调度策略——高响应比作业调度和时间片轮转。实验详细介绍了这两种调度方式的实现,包括代码示例和对应的输出结果。
摘要由CSDN通过智能技术生成

操作系统原理 实验1、2

1、高响应比作业调度

代码示例

#include<malloc.h>
#include<stdio.h>
#include<string.h>
#define NULL 0
#define N 10
typedef struct table
{
   
char name[8];
float in_well;
float begin_run;
float end_run;
float run_time;
float turnover_time;
}jobtable;
void init(jobtable job[],int n)
{
   
	int i,j;
	printf("input %d job information\n",n);
	printf("in_well run_time name\n");
	for(i=0;i<n;i++)
	{
   
	scanf("%f %f %s",&job[i].in_well,&job[i].run_time,job[i].name);
	job[i].begin_run=0.0;
	job[i].end_run=0.0;
	job[i].turnover_time=0.0;

	}
}
void print(jobtable job[],int n)
{
   
int i;
printf("name in_well  run_time   begin_run   end_run  turnover_time\n");
for(i=0;i<n;i++)
{
   
printf("%s\t%0.1f\t%0.1f\t",job[i].name,job[i].in_well,job[i].run_time);
if(job[i].begin_run==0.0&&job[i].end_run==0.0&&job[i].turnover_time==0.0)
printf("                       \n");
else printf("%9.1f%9.1f\t%0.1f\n",job[i].begin_run,job[i].end_run,job[i].turnover_time);

}
}
void swap(jobtable job[],
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值