-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.h
More file actions
101 lines (96 loc) · 1.57 KB
/
process.h
File metadata and controls
101 lines (96 loc) · 1.57 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <iostream>
#include <vector>
#include <string>
class Process{
public :
//constructor
Process();
void add_process(char PROC, int INIT, int CPU, int NUM, int IO);
//should be useful shit here that interacts with the variables
char getPROC(){
return PROC_ID;
}
int getINIT(){
return INIT_ARR;
}
int getCPU(){
return CPU_BURST;
}
int getNUM(){
return NUM_BURST;
}
int getIO(){
return IO_TIME;
}
int getTime(){
return INIT_ARR + (CPU_BURST * NUM_BURST) + (IO_TIME * NUM_BURST);
}
int getCPUReplace(){
return CPU_REPLACE;
}
void subINIT(){
INIT_ARR -= 1;
}
void subCPU(){
CPU_BURST -= 1;
}
void subNUM(){
NUM_BURST -= 1;
}
void replaceCPU(){
CPU_BURST = CPU_REPLACE;
}
void replaceINIT(){
INIT_ARR = INIT_REPLACE;
}
bool hasARRIVED(){
return ARR;
}
void setARRIVED(){
ARR = true;
}
bool isPreempted(){
return pre;
}
void setPre(bool which){
pre = which;
}
void new_INIT(int time){
INIT_ARR = IO_TIME + time;
}
void sub_intCPU(int i){
if (CPU_BURST-i <= 0){
CPU_BURST = 0;
}
else{
CPU_BURST = CPU_BURST - i;
}
}
int get_replaceCPU(){
return CPU_REPLACE;
}
void increaseWait(){
WAITTIME += 1;
}
double getWait(){
return WAITTIME;
}
int getNewTime(){
return newTime;
}
void setNewTime(int time){
newTime = time;
}
private :
char PROC_ID;
int INIT_ARR;
int CPU_BURST;
int NUM_BURST;
int IO_TIME;
int CPU_REPLACE;
int INIT_REPLACE;
bool ARR;
bool pre;
double WAITTIME;
int newTime;
};