传播优秀Word版文档 ,希望对您有帮助,可双击去除!
#include
typedef struct ProcessNode{ // 进程结点的基本结构 char name; //进程名
struct SJF_time{ //短作业优先
struct RR_time{ //时间片轮转的结点
struct Pri_time{ //优先权非抢占式
void main() {
int choice;
struct ProcessNode*next; }ProcessNode,*Linklist;
int finish_time; int turnaround_time; float weigtharound_time;
int finish_time; int turnaround_time; float weigtharound_time;
int flag_time;//赋值为进程的服务时间,为0则进程完成
int finish_time; int turnaround_time; float weigtharound_time; int flag;
struct FCFS_time{ //先到先服务
int finish_time; //完成时间 int turnaround_time; //周转时间 float weigtharound_time;//带权周转时间 int service_time; //服务时间 int arrive_time; //到达时间 int priority; //优先级
}FCFS_time;
}SJF_time;
}RR_time;
}Pri_time;
1 / 11
传播优秀Word版文档 ,希望对您有帮助,可双击去除!
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(\
printf(\进程名称 \
printf(\
printf(\到达时间 \ printf(\服务时间 \ printf(\优先级 \ printf(\
while(p) {
printf(\ %d \
printf(\ %c \
printf(\ %d \ printf(\ %d \ printf(\
p=p->next;
}
printf(\printf(\
printf(\、FCFS----先到先服务\\n\printf(\、SJF-----短作业优先\\n\printf(\、RR------时间片轮转\\n\printf(\、Pri-----优先权调度\\n\printf(\
printf(\printf(\
printf(\请在1—5之间选择: \scanf(\printf(\
printf(\输出进程的调用选择项
printf(\、退出\\n\
printf(\
传播优秀Word版文档 ,希望对您有帮助,可双击去除!
switch(choice) // }
Linklist read_information()//进程读入函数 { int i; int
num;
// ProcessNode ;
Linklist pro; Linklist p; }while(choice!=5);
{
case 1: FCFS_scheduling(head);
break;
break;
case 2: SJF_scheduling(head); case 3: RR_scheduling(head); case 4: Pri_scheduling(head); case 5: exit(); }
break; break;
Linklist head; printf(\
printf(\进程调度算法************ \\n\
head=(Linklist)malloc(sizeof(ProcessNode));//头结点
printf(\输入第%d个进程信息:\\n\
head->next=NULL; p=head; {
printf(\
printf(\请输入进程的个数:\printf(\
printf(\初始化信息************* \\n\printf(\
scanf(\
for(i=1;i<=num;i++)
pro=(Linklist)malloc(sizeof(ProcessNode));//创建进程结点
进程调度(C语言实现)-参考模板
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)