diff --git a/Assignment 08/200010003_lab8.zip b/Assignment 08/200010003_lab8.zip new file mode 100644 index 0000000..ef879e7 Binary files /dev/null and b/Assignment 08/200010003_lab8.zip differ diff --git a/Assignment 08/CS314_Report_Lab8.pdf b/Assignment 08/CS314_Report_Lab8.pdf new file mode 100644 index 0000000..3b674cb Binary files /dev/null and b/Assignment 08/CS314_Report_Lab8.pdf differ diff --git a/Assignment 08/data.xlsx b/Assignment 08/data.xlsx new file mode 100644 index 0000000..b5e4149 Binary files /dev/null and b/Assignment 08/data.xlsx differ diff --git a/Assignment 08/fifo.cpp b/Assignment 08/fifo.cpp index 2adbf93..249c90f 100644 --- a/Assignment 08/fifo.cpp +++ b/Assignment 08/fifo.cpp @@ -7,6 +7,17 @@ #include 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 requests) { vector pageTable(pages, -1); // array of size eq to num of addressable pages @@ -44,9 +55,17 @@ void FIFO(int pages, int frames, vector 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)"< requests; ifstream infile(filename); diff --git a/Assignment 08/fifo.out b/Assignment 08/fifo.out new file mode 100644 index 0000000..08e5b4b Binary files /dev/null and b/Assignment 08/fifo.out differ diff --git a/Assignment 08/images/r1.jpg b/Assignment 08/images/r1.jpg new file mode 100644 index 0000000..96d7cb6 Binary files /dev/null and b/Assignment 08/images/r1.jpg differ diff --git a/Assignment 08/images/r2.jpg b/Assignment 08/images/r2.jpg new file mode 100644 index 0000000..3e1a527 Binary files /dev/null and b/Assignment 08/images/r2.jpg differ diff --git a/Assignment 08/images/r3.jpg b/Assignment 08/images/r3.jpg new file mode 100644 index 0000000..0ad163c Binary files /dev/null and b/Assignment 08/images/r3.jpg differ diff --git a/Assignment 08/images/r4.jpg b/Assignment 08/images/r4.jpg new file mode 100644 index 0000000..f011b90 Binary files /dev/null and b/Assignment 08/images/r4.jpg differ diff --git a/Assignment 08/images/r5.jpg b/Assignment 08/images/r5.jpg new file mode 100644 index 0000000..c78a85c Binary files /dev/null and b/Assignment 08/images/r5.jpg differ diff --git a/Assignment 08/lru.cpp b/Assignment 08/lru.cpp index 37a3ff0..30b42f9 100644 --- a/Assignment 08/lru.cpp +++ b/Assignment 08/lru.cpp @@ -43,9 +43,17 @@ void LRU(int pages, int frames, vector 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)"< requests; ifstream infile(filename); diff --git a/Assignment 08/random.cpp b/Assignment 08/random.cpp index 6332232..ee57776 100644 --- a/Assignment 08/random.cpp +++ b/Assignment 08/random.cpp @@ -39,9 +39,17 @@ void Random(int pages, int frames, vector 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)"< requests; ifstream infile(filename); diff --git a/Assignment 08/random.out b/Assignment 08/random.out deleted file mode 100644 index 8ec5d48..0000000 Binary files a/Assignment 08/random.out and /dev/null differ diff --git a/Assignment 08/req.dat b/Assignment 08/req.dat new file mode 100644 index 0000000..6782823 --- /dev/null +++ b/Assignment 08/req.dat @@ -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 diff --git a/Assignment 08/req2.dat b/Assignment 08/req2.dat new file mode 100644 index 0000000..97defad --- /dev/null +++ b/Assignment 08/req2.dat @@ -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 diff --git a/Assignment 08/req3.dat b/Assignment 08/req3.dat new file mode 100644 index 0000000..882df9d --- /dev/null +++ b/Assignment 08/req3.dat @@ -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 diff --git a/Assignment 08/req4.dat b/Assignment 08/req4.dat new file mode 100644 index 0000000..b983dfb --- /dev/null +++ b/Assignment 08/req4.dat @@ -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 diff --git a/Assignment 08/req5.dat b/Assignment 08/req5.dat new file mode 100644 index 0000000..b02e4ac --- /dev/null +++ b/Assignment 08/req5.dat @@ -0,0 +1 @@ +1 2 3 4 1 2 5 1 2 3 4 5 \ No newline at end of file diff --git a/Assignment 08/run.sh b/Assignment 08/run.sh new file mode 100644 index 0000000..499c514 --- /dev/null +++ b/Assignment 08/run.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +bash run_random.sh 60 $1 60 req5.dat | grep "Faults" \ No newline at end of file diff --git a/Assignment 09/Lab 9 Worksheet.pdf b/Assignment 09/Lab 9 Worksheet.pdf new file mode 100644 index 0000000..48afadc Binary files /dev/null and b/Assignment 09/Lab 9 Worksheet.pdf differ