作业进程调度c语言,进程调度(C语言实现).doc

#include

#include

#include

typedef struct ProcessNode{ // 进程结点的基本结构

char name; //进程名

int service_time; //服务时间

int arrive_time; //到达时间

int priority; //优先级

struct FCFS_time{ //先到先服务

int finish_time; //完成时间

int turnaround_time; //周转时间

float weigtharound_time;//带权周转时间

}FCFS_time;

struct SJF_time{ //短作业优先

int finish_time;

int turnaround_time;

float weigtharound_time;

int flag;

}SJF_time;

struct RR_time{ //时间片轮转的结点

int finish_time;

int turnaround_time;

float weigtharound_time;

int flag_time;//赋值为进程的服务时间,为0则进程完成

}RR_time;

struct Pri_time{ //优先权非抢占式

int finish_time;

int turnaround_time;

float weigtharound_time;

}Pri_time;

struct ProcessNode*next;

}ProcessNode,*Linklist;

void main()

{

int choice;

Linklist p,head;

Linklist read_information();

Linklist FCFS_scheduling(Linklist head);

Linklist SJF_scheduling(Linklist head);

Linklist RR_scheduling(Linklist head);

Linklist Pri_scheduling(Linklist head);

head=read_information();//读入进程的基本信息

do{

p=head->next;

printf("\n");

printf("**********进程初始信息输出********** \n"); //输出初始化后的进程基本信息

printf("\n");

printf("进程名称 ");

printf("到达时间 ");

printf("服务时间 ");

printf("优先级 ");

printf("\n");

while(p)

{

printf(" %c ",p->name);

printf(" %d ",p->arrive_time);

printf(" %d ",p->service_time);

printf(" %d ",p->priority);

printf("\n");

p=p->next;

}

printf("\n");

printf("************************************ \n");//输出进程的调用选择项

printf("\n");

printf("1、FCFS----先到先服务\n");

printf("2、SJF-----短作业优先\n");

printf("3、RR------时间片轮转\n");

printf("4、Pri-----优先权调度\n");

printf("5、退出\n");

printf("\n");

printf("************************************ \n");

printf("\n");

printf("请在1—5之间选择:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值