-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschedulerMethods.h
81 lines (68 loc) · 2.46 KB
/
schedulerMethods.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*-----------------------------------------------------------------------------
* Class: schedulerMethods.h
* Author: Ricardo N. Guntur <[email protected]>
* Course: Operating Systems -- Professor Allan Gottlieb
-----------------------------------------------------------------------------*/
#ifndef LAB_2_TESTS_SCHEDULERMETHODS_H
#define LAB_2_TESTS_SCHEDULERMETHODS_H
#include <fstream>
#include <sstream>
#include <vector>
#include <iostream>
#include <string>
#include <stdio.h>
#include "Process.h"
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;
class schedulerMethods {
public:
vector <Process> process_vector;
vector <Process> sorted_vector;
vector <int> temp_vector; //For Sorting
schedulerMethods();
ifstream file;
int number_processes; //Number of processes
char unused; //unused char
int a; //Arrival Time
int b; //Max burst
int c; //Total CPU time needed
int m; //Max IO block time
int cpu_burst; //CPU Burst = randomOS(max burst)
int total_processes_terminated; //Current number of processes terminated
int total_cpu_time; //Time any process was running
float total_turnaround_time; //Total turnaround time of the algo
float total_wait_time; //Total wait time of the algo
float finish_time; //Finish cycle of algorithm
float total_block_time; //Time any process was blocked
queue <int> ready_queue; //Contains index which represent specific process object
queue <int> empty;
deque <int> sjf_queue;
bool any_running; //True if a process is running
bool is_found; //If process was found
bool has_blocked;
bool has_waited;
int front_queue;
int currentCycle;
int currentProcess;
int min;
int num_ready;
int min_vec_index;
int longest_ready_time;
int ready_process;
void reset_processes();
void handle_queue();
void print_summary();
void print_output();
void run_process(int currentCycle);
void set_process(int currentCycle);
void print_processes();
void process_input(string file);
int randomOS(int U);
void Fcfs();
void Uniprogrammed();
void sjf();
void rr();
};
#endif //LAB_2_TESTS_SCHEDULERMETHODS_H