-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutil.h
More file actions
40 lines (37 loc) · 1.05 KB
/
util.h
File metadata and controls
40 lines (37 loc) · 1.05 KB
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
//*****************************************************************************
// util.h - Define utilites for use in programs
//
// AUTHOR: Minh Mai
//
// Utility includes:
// + PROCESS QUEUE FACILITY
//
//
//
//*****************************************************************************
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include "sched.h"
#define QUEUE_SIZE 100
//*****************************************************************************
//
// PROCESS QUEUE Facility
//
//*****************************************************************************
/* Define a queue can hold up to 100 processes */
struct queue_t{
int in;
int out;
int k;
struct process_t pool[QUEUE_SIZE];
};
//This method initilize the queue before using
void init_queue(struct queue_t *queue);
//This method add a new process into the queue
void append(struct process_t *process, struct queue_t *queue);
//This method take the highest priority process out of the queue
struct process_t *take();