-
Notifications
You must be signed in to change notification settings - Fork 2
/
os-kernel.cpp
39 lines (32 loc) · 1004 Bytes
/
os-kernel.cpp
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
#include <iostream>
#include <vector>
#include <cstdlib>
#include <fstream>
#include "os-kernel.h"
#include "process.h"
#include "scheduler.h"
using namespace std;
int main(int argc, char* argv[]){ /* main function with command line arguments */
/* DRIVER*/
vector<entry> pcb; //main pcb
fstream ifile(argv[1], ios::in); //opening file provided by user
string buff;
getline(ifile, buff); //reading first line for no reason
while(getline(ifile, buff)){
init_proc(pcb, buff); //reading lines while they exist and passing them to initialiser
}
sortVec(pcb);
if(argv[3][0]=='f'){ //first come first serve
fcfs start(&pcb, stoi(argv[2]), argv[4]);
}
else if(argv[3][0]=='r'){ //round robin
round_robin start(&pcb, stoi(argv[2]), stoi(argv[4]), argv[5]);
}
else if(argv[3][0]=='p'){ //preemptive priority
priority start(&pcb, stoi(argv[2]), argv[4]);
}
else if(argv[3][0]=='s'){ //preemptive priority
sjf start(&pcb, stoi(argv[2]), argv[4]);
}
return 0;
}