-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (37 loc) · 1.11 KB
/
main.cpp
File metadata and controls
46 lines (37 loc) · 1.11 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
41
42
43
44
45
/*
* File: main.cpp
* Author: Peter Gish
*
* Created on February 10, 2018, 5:23 PM
*/
/*
* The program should accept three arguments:
* 1) input file name
* 2) block_duration: the decimal integer time length that a process
* is unavailable to fun after it blocks
* 3) time_slice: the decimal integer of the time slice for the
* Round-Robin scheduler
* -Arguments are passed in the order shown above
*
*/
#include "Scheduler.h"
#include <cstdlib>
#include <iostream>
#include <sstream>
#include "Scheduler.h"
int main(int argc, char** argv) {
if (argc != 4) {
std::cerr << "usage: Assignment1 input_file\n";
exit(1);
}
std::istringstream ss1(argv[2]);
int block_duration;
if (!(ss1 >> block_duration))
std::cerr << "Invalid argument1 " << argv[2] << '\n';
std::istringstream ss2(argv[3]);
int time_slice;
if (!(ss2 >> time_slice))
std::cerr << "Invalid argument " << argv[3] << '\n';
Scheduler s(argv[1], block_duration, time_slice); //create scheduler object and pass in command line arguments
return 0;
}