-
Notifications
You must be signed in to change notification settings - Fork 0
/
PCB.h
54 lines (32 loc) · 1.66 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
/* Process Control Block - PCB - Definition */
// Process Control Block (PCB) is a structure that saves process important information (PID , name, state).
// Example: process A (4937, "A", running)
#include <string.h> // String
#include <stdio.h> // Input and Output
#include <stdlib.h> // Library Definitions
enum processStateType
{
terminated = 0,
new = 1,
ready = 2,
running = 3,
waiting = 4
};
typedef enum processStateType stateType; // Process States
typedef struct processControlBlock PCB; // PCB structure
PCB* newPCB (char* processName, int argc, char** argv); // Create new PCB
pid_t getPCBPid (PCB* pcb); // Get process PID
pid_t setPCBPid (PCB* pcb, pid_t pid); // Set process PID
char* getPCBName (PCB* pcb); // Get process name
void setPCBName (PCB* pcb, char* name); // Set process name
int getPCBArgc (PCB* pcb); // Get process arguments counter
void setPCBArgc (PCB* pcb, int argc); // Set process arguments counter
char** getPCBArgv (PCB* pcb); // Get process arguments vector
void setPCBArgv (PCB* pcb, char** argv); // Set process arguments vector
stateType getPCBState (PCB* pcb); // Get process state
void setPCBState (PCB* pcb, stateType state); // Set process state
void setPCBState (PCB* pcb, stateType state); // Set process state
void getPCBTimeStructure (PCB* pcb, time_t* t_s, suseconds_t* t_us); // Get process time controller structure
void setPCBTimeStructure (PCB* pcb, struct timeval t); // Set process time controller structure
char* getPCBQueue (PCB* pcb); // Get process last/actual queue
void setPCBQueue (PCB* pcb, char* q); // Set process last/actual queue