-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.h
executable file
·74 lines (68 loc) · 1.53 KB
/
process.h
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
#ifndef PROCESS_H
#define PROCESS_H
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class process {
protected:
public:
int pid;
int burst;
int arrival;
int timeRemaining;
int doneWaiting;
int finishTime;
process() {
this->pid = 0;
this->burst = 0;
this->arrival = 0;
this->timeRemaining =0;
this->doneWaiting = 0;
this->finishTime = 0;
};
process(int pid, int burst, int arrival) {
this->pid = pid;
this->burst = burst;
this->arrival = arrival;
this->timeRemaining = burst;
this->doneWaiting = 0;
this->finishTime = 0;
};
~process() {
};
process( const process &p) {
pid = p.pid;
burst = p.burst;
arrival = p.arrival;
timeRemaining = p.timeRemaining;
doneWaiting = p.doneWaiting;
finishTime = p.finishTime;
};
process& operator= (const process &p){
pid = p.pid;
burst = p.burst;
arrival = p.arrival;
timeRemaining = p.timeRemaining;
doneWaiting = p.doneWaiting;
finishTime = p.finishTime;
return *this;
};
bool operator== (const process &p) {
return (this->pid==p.pid && this->arrival == p.arrival && this->burst == p.burst);
}
bool operator!= (const process &p){
return !(this->pid==p.pid && this->arrival == p.arrival && this->burst == p.burst);
}
friend ostream& operator<< (ostream &os, const process &p) {
p.display(os);
return os;
};
void display(ostream &os) const {
os << "\t" << pid;
os << "\t" << burst;
os << "\t" << arrival;
os << "\t\t" << timeRemaining;
};
};
#endif