操作系统的一个小问题~~~~~

来源:百度知道 编辑:UC知道 时间:2024/06/03 19:15:55
先来先服务的调度算法??用C语言实现.又摆脱高手们咯!!~~谢谢!!!
拜托 不是摆脱~~sorry!!!!~~

先来先服务的调度算法(C语言)主要数据结构:
typedef struct Lnode
{
char name[10];
struct Lnode *point;
int arrivetime;
int runtime;
char situation;
int wtime; //用来计算周转时间
}Lnode,*Linklist;

流程图:

代码:
#include<stdio.h>
#include<malloc.h>

//使用链表
typedef struct Lnode
{
char name[10];
struct Lnode *point;
int arrivetime;
int runtime;
char situation;
int wtime; //用来计算周转时间
}Lnode,*Linklist; //定义结点即定义pcb块

void creatlist(Linklist &L,int n) //给每个结点初始化
{
int i;
Linklist p;
L=(Linklist)malloc(sizeof(Lnode));
L->point=NULL;
for(i=n;i>0;i--)
{
p=(Linklist)malloc(sizeof(Lnode));
printf("Please input the name of the course\n");
getchar();
gets(p->name);
printf("then input the arrivetime and the runtime!\n");
scanf("%d %d",&p->arrivetime,&p->runtime);<