1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > c语言进程调度报告 进程调度(C语言实现).doc

c语言进程调度报告 进程调度(C语言实现).doc

时间:2019-11-08 04:39:28

相关推荐

c语言进程调度报告 进程调度(C语言实现).doc

进程调度(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之间选择:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。