-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPCB.h
53 lines (40 loc) · 1.56 KB
/
PCB.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
#pragma once
using namespace std;
// This class for building the Process control Block (PCB) strucure
class PCB {
public:
// Process id
int id;
// The time that in which the process enter the ready queue for the first time
int arrivalTime;
// The total cpu burst of the process
int CPUBurst;
// Process size
int sizeInBytes;
// The time in which the process finish the execution
int finishTime;
// The total time the process wait in the ready queue
int waitingTime;
// The total time from the request of the process until finish the execution
int turnAroundTime;
// The last time the process was in the ready queue, I use it for som calculations
int lastTimeInReady;
// The remaining cpu burst after some (zero or more) times in the cpu, I use it for som calculations
int remainingBurst;
// The time from the request of the process until first time enter the cpu
int responseTime;
// Constrictor to create PCB for each process
PCB(int id, int arrivalTime, int CPUBurst, int sizeInBytes) // Constructor
{
this->id = id;
this->arrivalTime = arrivalTime;
this->CPUBurst = CPUBurst;
this->remainingBurst = CPUBurst; // At first time the process did not finish any burst
this->sizeInBytes = sizeInBytes;
this->lastTimeInReady = arrivalTime; // From this to the end will be changed while running the program
this->finishTime = 0;
this->waitingTime = 0;
this->turnAroundTime = 0;
this->responseTime = -1;
}
};