-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduler.h
More file actions
47 lines (39 loc) · 1.06 KB
/
Scheduler.h
File metadata and controls
47 lines (39 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "Average.h"
#include <vector>
#include <queue>
#include <stdlib.h>
#include "Queue.h"
#include <iostream>
#include <sstream>
#ifndef SCHED_SCHEDULER_H
#define SCHED_SCHEDULER_H
using std::vector;
using std::queue;
using std::stringstream;
class Scheduler {
private:
int clock;
Average average;
vector<Process> processes;
vector<Process>::iterator processIterator;
Queue queues[5];
int quantum;
int numQueues;
bool handleIO;
int IoOffset;
bool finished;
queue<Process*> IOQueue;
int ageLimit;
stringstream buffer;
void insertShiftedProcesses(vector<Process*>& shiftedProcesses);
bool addArrivedProcesses(int clockTime);
Process* getTopProcess();
void updateAgeing(vector<Process*>& shiftedProcesses);
public:
Scheduler();
Scheduler(int timeQuantum, vector<Process>& allProcesses, int nQueues, int ageing, int startTick);
void runMFQS();
void setHandleIO(bool handleIo) { handleIO = handleIo; }
void setIoOffset(int ioOffset) { IoOffset = ioOffset; }
};
#endif //SCHED_SCHEDULER_H