一、说明
作业/进程调度算法 –
先来先服务算法
- 非抢占式的算法。
- 公平、算法实现简单。
- 按照作业/进程到达的先后顺序进行服务,排在长作业/进程后面的短作业需要等待很长时间,带权周转时间很大,对短作业来说用户体验不好。
- 不会出现进程饥饿的情况。
二、代码
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
using namespace std;
class FCFS {
//友元
friend istream& operator>>(istream& is, FCFS& p);
friend ostream& operator<<(ostream& os, const FCFS& p);
friend void run(vector<FCFS>& vec, int N);
public:
//构造函数
FCFS() : name(string()), daodatime(0), fuwutime(0), kaishitime(0), wanchengtime(0), zhouzhuangtime(0), daiquantime(0) {
}
string& getName