-
Notifications
You must be signed in to change notification settings - Fork 0
/
scheduler.h
28 lines (23 loc) · 899 Bytes
/
scheduler.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
#ifndef ROBINWAITA_SCHEDULER_H
#define ROBINWAITA_SCHEDULER_H
#include "process.h"
typedef struct initData initData;
struct Queue;
typedef struct Node {
Process *process;
struct Node *next;
} Node;
typedef struct Queue {
Node *front;
Node *rear;
int numElements;
} Queue;
void displayProcess(Process *p, Queue *q, initData *data); //display new process when added to queue
void initQueue(Queue *q); //initialize process queue
int isEmpty(Queue *q); //check if queue empty
void enQueue(Queue *q, Process *p); //add process struct to queue
void deQueue(Queue *q); //remove process struct from queue
int timerSetup(Queue *q); //setup timerfd
void manageQueue(struct initData *data); //scheduling logic, gets called repeatedly
void addElapsedTime(Process *p, double *totalTime, initData *data); //get total time for running processes and display
#endif //ROBINWAITA_SCHEDULER_H