summaryrefslogtreecommitdiff
path: root/task-1-29994705.h
blob: 5be9a789d29b80469c5b1e550285ad095d4d6543 (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
/*
 * task-1-29994705.h
 * 
 * Alexander Occhipinti
 * Student ID: 29994705
 * Created: 15 Oct 2020 
 * Modified: 15 Oct 2020 
 * 
 * The header file for task-1-29994705.c
 * See task-1-29994705.c for documentation
 *  
*/

#ifndef _TASK1_H
#define _TASK1_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_NUM_PROCS 10
#define WAIT_PER_CYCLE 1


/* Special enumerated data type for process state */
typedef enum {
    UNENTERED, READY, RUNNING, 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