Repository navigation
Expand file tree
/
Copy pathprocess.h
More file actions
60 lines (53 loc) · 2.03 KB
/
Copy pathprocess.h
File metadata and controls
60 lines (53 loc) · 2.03 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
#pragma once
// Process State - Represents the state of a process
enum class ProcessState
{
New,
Ready,
Running,
Waiting,
Terminated
};
// Process - Represents a process in the operating system
class Process
{
private:
// Identity
int pid; // pid - process id
int arrivalTime; // arrivalTime - time at which process arrives
int burstTime; // burstTime - time required to complete the process
int priority; // priority - priority of the process
int memorySize; // memorySize - memory required by the process (KB)
// Runtime
int remainingTime; // remainingTime - time remaining for the process to complete
ProcessState state; // state - current state of the process
int startTime; // startTime - time at which process starts
int completionTime; // completionTime - time at which process completes
int waitingTime; // waitingTime - time spent waiting in ready queue
int turnaroundTime; // turnaroundTime - time from arrival to completion
int responseTime; // responseTime - time from arrival to first execution
public:
// Constructor
Process(int pid, int arrivalTime, int burstTime, int priority, int memorySize);
// Getters
int getPid() const;
int getArrivalTime() const;
int getBurstTime() const;
int getPriority() const;
int getMemorySize() const;
int getRemainingTime() const;
ProcessState getState() const;
int getStartTime() const;
int getCompletionTime() const;
int getWaitingTime() const;
int getTurnaroundTime() const;
int getResponseTime() const;
// Setters
void setRemainingTime(int remainingTime) ;
void setState(ProcessState state) ;
void setStartTime(int startTime) ;
void setCompletionTime(int completionTime) ;
void setWaitingTime(int waitingTime) ;
void setTurnaroundTime(int turnaroundTime) ;
void setResponseTime(int responseTime) ;
};