【实验名称】
进程调度——时间片轮转算法
【实验名称】
巩固和加深处理机调度的概念,设计按时间片轮转算法。
【实验原理】
利用按时间片轮转算法,设计调度算法,模拟实现处理机的调度。
【源代码】
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
typedef struct PCB {
//用一个结构体来模拟进程PCB
int time = 0;
string name;
struct PCB* next = NULL;//声明一个结构体指针,指向其下一个结构体
}PCB, * PCBlist;
void Input(int n, PCBlist front) {
//n是进程的数目,front是进程的头指针
PCBlist P = front;
for (n; n > 0