短进程优先调度spf.docx

#include stdio.h #include stdlib.h #define MAX 5 // 进程数 /* 短进程优先算法 */ struct pro { int num; // 进程名 int arriveTime; // 到达时间 int burst; // 运行时间 ; struct pro *next; }; // 函数声明 struct pro* creatList(); void insert(struct pro *head,struct pro *s); struct pro* searchByAT(struct pro *head,int AT); void run(struct pro *head); void del(struct pro* p); int getCount(struct pro *head,int time); struct pro* creatList() // 创建链表,按照进程的到达时间排列 { struct pro* head=(struct pro*)malloc(sizeof(struct pro)); head-next=NULL; struct pro* s; int i; for(i=0;iMAX;i++) { s=(struct pro*)malloc(sizeof(struct pro)); printf( 请

文档评论(0)

1亿VIP精品文档

相关文档