blob: f926abc63470bb88fe4ac9edd70a01a0af35db3e (
plain)
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
|
/*
* task-2-29994705.h
*
* Alexander Occhipinti
* Student ID: 29994705
* Created: 18 Oct 2020
* Modified: 19 Oct 2020
*
* The header file for task-2-29994705.c
* See task-2-29994705.c for documentation
*
*/
#ifndef _TASK2_H
#define _TASK2_H
#define DEFAULT_INPUT_PATH "process-data.txt" // Default file path to read the process PCBs from before simulation
#define RESULT_FILE_PATH "scheduler-result.txt" // Default file path for the results after simulation
#define MAX_PATH_SIZE 256
#define MAX_QUEUE_SIZE 10
#define MAX_NUM_PROCS 10
#define TIME_QUANTUM 2
#define WAIT_PER_CYCLE 1
/* Special enumerated data type for process state */
typedef enum {
UNENTERED, READY, RUNNING, PAUSED, EXIT
} process_state_t;
/* C data structure used as process control block.
* The scheduler should create one instance
* per running process in the system
*/
typedef struct {
char process_name[11]; // a string that identifies the process
/* Times measured in seconds */
int entryTime; // time process entered system
int serviceTime; // the total CPU time required by the process
int deadline; // The deadline of the process (for analysis)
int remainingTime; // remaining service time until completion
int timeStarted; // the time the process entered the RUNNING state
int timeFinished; // the time the process entered the EXIT state (i.e. it completed)
process_state_t state; // current process state (e.g. READY)
} pcb_t;
#endif
|