-
Notifications
You must be signed in to change notification settings - Fork 0
/
dscheduler.h
50 lines (39 loc) · 1.15 KB
/
dscheduler.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
/*
Do not edit the contents of this file
*/
#ifndef DSCHEDULER_H
#define DSCHEDULER_H
#define MAX_LINE_LENGTH 1000
#define WRONG_NUM_INPUTS 1
#define BAD_MALLOC 2
#define BAD_INPUT 3
enum POLICIES {
FCFS = 0,
SSTF = 1,
SCAN = 2,
C_SCAN = 3,
};
struct IntArray
{
int elements;
int *data;
};
struct schedulerInput
{
int startTrack;
int direction;
struct IntArray requests;
};
struct schedulerResult
{
int totalHeadMovement;
struct IntArray requests;
};
struct schedulerInput loadRequest();
struct schedulerResult processRequest(enum POLICIES policy, struct schedulerInput request);
void printResults(struct schedulerResult results);
struct schedulerResult process_FCFS_request(struct schedulerInput request);
struct schedulerResult process_SSTF_request(struct schedulerInput request);
struct schedulerResult process_SCAN_request(struct schedulerInput request);
struct schedulerResult process_C_SCAN_request(struct schedulerInput request);
#endif