-
Notifications
You must be signed in to change notification settings - Fork 0
/
PCB.h
53 lines (43 loc) · 1.08 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
#ifndef PCB_H
#define PCB_H
/*
Group 5: Nok Him Nam, Jowy Tran, Mark Johnson, David Humphreys
Date : 28/ 01/ 2015
Assignment : Problem 2 - Scheduling
*/
enum state_type {
created,
ready,
running,
blocked,
interrupted,
terminated
};
typedef enum state_type State;
struct PCB {
char name[20];
int pid;
int priority;
int interrupt_simulator;
unsigned int pc;
State currentState;
};
typedef struct PCB* PCB_p;
PCB_p createPCB(char* name, int newPid, int newPriority, int theInterruptSimulator,
int thePcValue, State theState);
char* getName(PCB_p pcb);
int getPid(PCB_p pcb);
int getPriority(PCB_p pcb);
int getInterruptSimulator(PCB_p pcb);
int getPCValue(PCB_p pcb);
char* getState(PCB_p pcb);
void freePCB(PCB_p pcb);
void toString(PCB_p pcb);
void toStringFileVersion(PCB_p pcb, FILE* theOuputFile);
void setName(PCB_p pcb, char* newName);
void setPid(PCB_p pcb, int newPid);
void setPriority(PCB_p pcb, int newPriority);
void setInterruptSimulator(PCB_p pcb, int theInterruptSimulator);
void setPCValue(PCB_p pcb, int thePCValue);
void setTheState(PCB_p pcb, State theState);
#endif