#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之间选择: