Skip to content

Commit

Permalink
a8 moment
Browse files Browse the repository at this point in the history
  • Loading branch information
Whitelisted2 committed Mar 24, 2023
1 parent df94692 commit bf76d63
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 0 deletions.
Binary file added Assignment 08/200010003_lab8.zip
Binary file not shown.
Binary file added Assignment 08/CS314_Report_Lab8.pdf
Binary file not shown.
Binary file added Assignment 08/data.xlsx
Binary file not shown.
19 changes: 19 additions & 0 deletions Assignment 08/fifo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
#include <ctime>
using namespace std;

// 4 mem size
// 1 2 3 4 1 5 2
// m m m m h m h : fifo >
// m m m m h m m : lru

// 4 mem size
// 1 2 3 4 1 2 5 1 2 3 4 5
// m m m m h h m m m m m m : fifo
// m m m m h h m h h m m m : lru >


void FIFO(int pages, int frames, vector<int> requests)
{
vector<int> pageTable(pages, -1); // array of size eq to num of addressable pages
Expand Down Expand Up @@ -44,9 +55,17 @@ void FIFO(int pages, int frames, vector<int> requests)
// hits: 5 12 16 for 10 20 30
int main(int argc, char *argv[])
{
if (argc != 5) {
cout << "Invalid number of parameters." << endl;
exit(2);
}
int pages = atoi(argv[1]);
int frames = atoi(argv[2]);
int blocks = atoi(argv[3]);
if(blocks < pages){
cout<<"Invalid parameter set. Want x < z in the input (x, y, z)"<<endl;
exit(1);
}
string filename = argv[4];
vector<int> requests;
ifstream infile(filename);
Expand Down
Binary file added Assignment 08/fifo.out
Binary file not shown.
Binary file added Assignment 08/images/r1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assignment 08/images/r2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assignment 08/images/r3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assignment 08/images/r4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assignment 08/images/r5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions Assignment 08/lru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ void LRU(int pages, int frames, vector<int> requests)

int main(int argc, char *argv[])
{
if (argc != 5) {
cout << "Invalid number of parameters." << endl;
exit(2);
}
int pages = atoi(argv[1]);
int frames = atoi(argv[2]);
int blocks = atoi(argv[3]);
if(blocks < pages){
cout<<"Invalid parameter set. Want x < z in the input (x, y, z)"<<endl;
exit(1);
}
string filename = argv[4];
vector<int> requests;
ifstream infile(filename);
Expand Down
8 changes: 8 additions & 0 deletions Assignment 08/random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,17 @@ void Random(int pages, int frames, vector<int> requests)

int main(int argc, char *argv[])
{
if (argc != 5) {
cout << "Invalid number of parameters." << endl;
exit(2);
}
int pages = atoi(argv[1]);
int frames = atoi(argv[2]);
int blocks = atoi(argv[3]);
if(blocks < pages){
cout<<"Invalid parameter set. Want x < z in the input (x, y, z)"<<endl;
exit(1);
}
string filename = argv[4];
vector<int> requests;
ifstream infile(filename);
Expand Down
Binary file removed Assignment 08/random.out
Binary file not shown.
1 change: 1 addition & 0 deletions Assignment 08/req.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
68 35 85 67 71 24 89 61 57 91 30 47 38 87 9 49 29 67 55 84 90 46 59 33 12 50 34 26 36 39 55 66 16 41 85 22 64 68 87 29 49 87 15 49 6 17 41 98 69 22 33 63 63 29 76 5 6 47 7 74 56 11 29 47 24 26 16 89 49 96 8 76 4 52 56 29 2 30 94 27 19 35 32 98 87 25 36 41 1 49 22 87 77 70 62 27 41 76 11 69 29 58 77 67 92 68 89 85 70 17 76 17 15 63 63 49 47 5 6 30 33 41 85 11 64 87 56 76 29 69 68 55 16 24 92 47 50 34 49 41 38 27 26 87 90 35 68 22 59 46 96 36 33 98 85 71 71 87 92 61 9 49 29 67 55 84 90 46 59 33 12 50 34 26 36 39 55 66 16 41 85 22 64 68 87 29 49 87 15 49 6 17 41 98 69 22 33 63 63 29 76 5 6 47 7 74 56 11 29 47 24 26 16 89 49 96 8 76 4 52 56 29 2 30 94 27 19 35 32 98 87 25 36 41 1 49 22 87 77 70 62 27 41 76 11 69 29 58 77 67 92 68 89 85 70 17 76 17 15 63 63 49 47 5 6 30 33 41 85 11 64 87 56 76 29 69 68 55 16 24 92 47 50 34 49 41 38 27 26 87 90 35 68 22 59 46 96 36 33 98 85 71 71 87 92 61 9 49 29 67 55 84 90 46 59 33 12 50 34 26 36 39 55 66 16 41 85 22 64 68 87 29 49 87 15 49 6 17 41 98 69 22 33 63 63 29 76 5 6 47 7 74 56 11 29 47
1 change: 1 addition & 0 deletions Assignment 08/req2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 5 6 7 4 3 10 9 9
1 change: 1 addition & 0 deletions Assignment 08/req3.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 change: 1 addition & 0 deletions Assignment 08/req4.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7
1 change: 1 addition & 0 deletions Assignment 08/req5.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 3 4 1 2 5 1 2 3 4 5
3 changes: 3 additions & 0 deletions Assignment 08/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

bash run_random.sh 60 $1 60 req5.dat | grep "Faults"
Binary file added Assignment 09/Lab 9 Worksheet.pdf
Binary file not shown.

0 comments on commit bf76d63

Please sign in to comment.