This commit is contained in:
jazzy1902 2024-09-03 17:11:02 +05:30
parent cf829698f8
commit 342c7225e3
5 changed files with 90 additions and 0 deletions

6
lab3/Makefile Normal file
View File

@ -0,0 +1,6 @@
scheduler.out: scheduler.cpp
g++ scheduler.cpp -o scheduler.out
run_sched: scheduler.out
./scheduler.out $(WORKLOAD_FILE) $(SCHEDULING_ALGORITHM)

11
lab3/process1.dat Normal file
View File

@ -0,0 +1,11 @@
<html>
<body>
<pre>
0 100 2 90 2 80 3 70 2 60 2 10 -1
2 80 2 80 2 50 3 70 2 40 2 10 -1
3 70 2 70 2 40 3 70 2 20 2 10 -1
4 10 2 60 2 30 3 70 2 10 2 10 -1
5 3 2 3 2 3 -1
6 5 -1
10 200 2 3 -1
</pre></body></html>

22
lab3/process2.dat Normal file
View File

@ -0,0 +1,22 @@
<html>
<body>
<pre>
0 5 -1
1 3 2 3 2 3 -1
6 10 2 60 2 30 3 70 2 10 2 10 -1
23 3 2 3 2 3 -1
24 70 2 70 2 40 3 70 2 20 2 10 -1
25 3 2 3 2 3 -1
26 80 2 80 2 50 3 70 2 40 2 10 -1
27 3 2 3 2 3 -1
28 25 2 10 -1
29 3 2 3 2 3 -1
31 3 2 3 2 3 -1
33 3 2 3 2 3 -1
35 3 2 3 2 3 -1
40 3 2 3 2 3 -1
40 3 2 3 2 3 -1
42 3 2 3 2 3 -1
43 3 2 3 2 3 -1
45 3 2 3 2 3 -1
</pre></body></html>

16
lab3/process3.dat Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
0 15 2 5 2 15 2 5 2 15 2 5 2 15 2 5 2 15 2 5 2 15 2 5 2 15 2 5 2 15 2 5 2 5 2 15 2 5 2 5 -1
2 100 2 180 2 10 -1
5 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 -1
8 50 6 100 2 10 -1
12 15 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 -1
20 80 2 80 2 201 2 15 -1
30 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 -1
35 6 -1
36 8 50 2 -1
37 100 -1
38 5 2 2 -1
40 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 2 15 -1
</pre></body></html>

35
lab3/scheduler.cpp Normal file
View File

@ -0,0 +1,35 @@
#include <iostream>
#include <fstream>
#include <cstring>
#include <unistd.h>
#include <chrono>
using namespace std;
void fifo() {
}
int main(int argc, char **argv) {
if(argc != 3)
{
cout <<"usage: ./scheduler.out <path-to-workload-file> <scheduler_algorithm>\nprovided arguments:\n";
for(int i = 0; i < argc; i++)
cout << argv[i] << "\n";
return -1;
}
char *file_to_search_in = argv[1];
char *scheduler_algorithm = argv[2];
ifstream file(file_to_search_in, ios::binary);
string buffer;
// buffer.resize();
// file.read(&buffer[0], len2);
while(getline(file, buffer)) {
cout << buffer << endl;
}
return 0;
}