多级队列调度算法和多级反馈队列的调度算法 优缺点

来源:百度知道 编辑:UC知道 时间:2024/06/03 22:40:06
请问多级反馈队列调度是多级队列调度的升级吗? 后者比前者好在哪里? 为什么啊?(请举个通俗小例子)
还有多级反馈队列调度 缺点是什么呢?

#include "stdio.h"
#include <stdlib.h>
#include <conio.h>
#define getpch(type) (type*)malloc(sizeof(type))
#define NULL 0
int time[3];
struct program { /* 定义进程控制块PCB */
char name[10];
char state;
int queue;//进程队列
int priority; // 数字越小优先级越高
int needtime;//需运行时间
int runtime; //已经运行时间
struct program *link;
}*ready=NULL;
typedef struct program PROGRAM;
PROGRAM *run=NULL,*head1=NULL,*head2=NULL,*head3=NULL,*end1=NULL,*end2=NULL,*end3=NULL;
/*PROCESS *high_priority(PROCESS *P) //选择优先级最高的进程
{
PROCESS *q,*p; //问题,入口形参中
q=p;

while(p->next!=NULL)
{
if(q->priority>p->priority)
q=p;
p=p->next;
}
return q;
}*/

void sort(PROGRAM *p)
{switch(p->queue)
{case 1:
{if(head1==NULL) {head1=p;end1=p;}
else
{end1->link=p;end1=p;p