From df94692ee968b07cbe6bb0b545f6852f3fe61f8b Mon Sep 17 00:00:00 2001 From: Siddharth P <90827725+Whitelisted2@users.noreply.github.com> Date: Sun, 19 Mar 2023 19:58:08 +0530 Subject: [PATCH] a8 --- Assignment 08/.vscode/settings.json | 5 +++ Assignment 08/Makefile | 2 + Assignment 08/fifo.cpp | 60 ++++++++++++++++++++++++++++ Assignment 08/lru.cpp | 59 +++++++++++++++++++++++++++ Assignment 08/random.cpp | 56 ++++++++++++++++++++++++++ Assignment 08/random.out | Bin 0 -> 44680 bytes Assignment 08/req1.dat | 1 + Assignment 08/run_fifo.sh | 4 ++ Assignment 08/run_lru.sh | 5 +++ Assignment 08/run_random.sh | 4 ++ 10 files changed, 196 insertions(+) create mode 100644 Assignment 08/.vscode/settings.json create mode 100644 Assignment 08/Makefile create mode 100644 Assignment 08/fifo.cpp create mode 100644 Assignment 08/lru.cpp create mode 100644 Assignment 08/random.cpp create mode 100644 Assignment 08/random.out create mode 100644 Assignment 08/req1.dat create mode 100644 Assignment 08/run_fifo.sh create mode 100644 Assignment 08/run_lru.sh create mode 100644 Assignment 08/run_random.sh diff --git a/Assignment 08/.vscode/settings.json b/Assignment 08/.vscode/settings.json new file mode 100644 index 0000000..0cba2e6 --- /dev/null +++ b/Assignment 08/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "iostream": "cpp" + } +} \ No newline at end of file diff --git a/Assignment 08/Makefile b/Assignment 08/Makefile new file mode 100644 index 0000000..13dd530 --- /dev/null +++ b/Assignment 08/Makefile @@ -0,0 +1,2 @@ +clean: + rm -rf *.out \ No newline at end of file diff --git a/Assignment 08/fifo.cpp b/Assignment 08/fifo.cpp new file mode 100644 index 0000000..2adbf93 --- /dev/null +++ b/Assignment 08/fifo.cpp @@ -0,0 +1,60 @@ +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +void FIFO(int pages, int frames, vector requests) +{ + vector pageTable(pages, -1); // array of size eq to num of addressable pages + queue pageQueue; // to store pages in queue, i.e. which are in main memory + int pageFaults = 0; + int hit = 0; + // cout << "Total Requests: "<< requests.size() << endl; + for (int i = 0; i < requests.size(); i++) + { + int page = requests[i] - 1; + // cout << "Requesting " << page+1 <<" ..."; + if (pageTable[page] == -1) + { + pageFaults++; + // cout << "FAULT"; + if (pageQueue.size() == frames) // no empty slots left + { + int victimPage = pageQueue.front(); + pageTable[victimPage] = -1; // eviction by fifo policy + pageQueue.pop(); + } + pageQueue.push(page); + pageTable[page] = 1; + } else { + // cout << "HIT"; + hit++; + } + // cout << endl; + } + cout << "FIFO Page Faults: " << pageFaults << endl; + cout << "FIFO Page Hits: " << hit << endl; + +} + +// hits: 5 12 16 for 10 20 30 +int main(int argc, char *argv[]) +{ + int pages = atoi(argv[1]); + int frames = atoi(argv[2]); + int blocks = atoi(argv[3]); + string filename = argv[4]; + vector requests; + ifstream infile(filename); + int page; + while (infile >> page) { + requests.push_back(page); + } + infile.close(); + FIFO(pages, frames, requests); + return 0; +} diff --git a/Assignment 08/lru.cpp b/Assignment 08/lru.cpp new file mode 100644 index 0000000..37a3ff0 --- /dev/null +++ b/Assignment 08/lru.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +using namespace std; + +void LRU(int pages, int frames, vector requests) +{ + vector pageTable(pages, -1); // array of size eq to num of addressable pages + vector pageList; // to store pages in order of their use + int pageFaults = 0; + int hit = 0; + // cout << "Total Requests: "<< requests.size() << endl; + for (int i = 0; i < requests.size(); i++) + { + int page = requests[i] - 1; + // cout << "Requesting " << page+1 <<" ..."; + if (pageTable[page] == -1) + { + pageFaults++; + // cout << "FAULT"; + if (pageList.size() == frames) // no empty slots left + { + int victimPage = pageList.back(); + pageTable[victimPage] = -1; // eviction by lru policy + pageList.pop_back(); // evict + } + pageList.insert(pageList.begin(), page); // insert at beg + pageTable[page] = 1; + } else { + // cout << "HIT"; + hit++; + pageList.erase(find(pageList.begin(), pageList.end(), page)); + pageList.insert(pageList.begin(), page); + } + // cout << endl; + } + cout << "LRU Page Faults: " << pageFaults << endl; + cout << "LRU Page Hits: " << hit << endl; +} + +int main(int argc, char *argv[]) +{ + int pages = atoi(argv[1]); + int frames = atoi(argv[2]); + int blocks = atoi(argv[3]); + string filename = argv[4]; + vector requests; + ifstream infile(filename); + int page; + while (infile >> page) { + requests.push_back(page); + } + infile.close(); + LRU(pages, frames, requests); + return 0; +} diff --git a/Assignment 08/random.cpp b/Assignment 08/random.cpp new file mode 100644 index 0000000..6332232 --- /dev/null +++ b/Assignment 08/random.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +void Random(int pages, int frames, vector requests) +{ + vector pageTable(pages, -1); + int pageFaults = 0; + int hit = 0; + srand(time(NULL)); + for (int i = 0; i < requests.size(); i++) + { + int page = requests[i]; + if (pageTable[page] == -1) + { + pageFaults++; + if (count(pageTable.begin(), pageTable.end(), 1) == frames) + { + int victimPage = rand() % pages; + while (pageTable[victimPage] != 1) + { + victimPage = rand() % pages; + } + pageTable[victimPage] = -1; + } + pageTable[page] = 1; + } else { + hit++; + } + } + cout << "Random Page Faults: " << pageFaults << endl; + cout << "Random Page Hits: " << hit << endl; +} + +int main(int argc, char *argv[]) +{ + int pages = atoi(argv[1]); + int frames = atoi(argv[2]); + int blocks = atoi(argv[3]); + string filename = argv[4]; + vector requests; + ifstream infile(filename); + int page; + while (infile >> page) + { + requests.push_back(page); + } + infile.close(); + Random(pages, frames, requests); + return 0; +} diff --git a/Assignment 08/random.out b/Assignment 08/random.out new file mode 100644 index 0000000000000000000000000000000000000000..8ec5d481fcb633512d76d3bc015576c7d891ae11 GIT binary patch literal 44680 zcmeHwe|(hHmG_fhlC~P61x-<5R8&xjnGi52)&v-sNWe%EL`@#%|T(mRhQLT z%=1L+r+>YlJQ~h(&pG$pbI(2Z+;i{DGtZrY=HURQagq$p@` znd+4h$w&X-@`-;f`1EX9R#2}e+G}Bc2Wq+LK zdP7`qi0dg>$@WxG*^|W3Up>opLLX>!`NY45;jFig>p9^v=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sI|d6=x{Yt(Z#{du+R@l)vM z9re}olM3$S`J?!q?Z4uvub#71ke)-*FXev<_XcjL|4M)LJf?!=ANu8N|IZ*&6G~0> zT-@H6tmU+~YG1(;G>)&zTlLlRo%^}I;*-*B`zicX)F&N_D$w=%#x`c|kxc^&Rau zNV4@Wy}gZCYAlSrQT6%jgBDeZ)1exBiwQSDZa>Ihe8$%rjXL}({Z+p{1f0?xx7M|5 fyS)7&zOSfXs$GS{V*sx8Z~T(vxWrMxQ8fM^L;t&K literal 0 HcmV?d00001 diff --git a/Assignment 08/req1.dat b/Assignment 08/req1.dat new file mode 100644 index 0000000..7c611e4 --- /dev/null +++ b/Assignment 08/req1.dat @@ -0,0 +1 @@ +1 10 32 2 12 5 2 16 9 30 21 35 6 8 7 17 22 38 45 53 43 10 8 20 30 16 18 56 60 57 53 27 35 24 32 13 17 4 5 18 20 52 28 25 18 9 19 3 31 59 11 6 23 28 37 48 diff --git a/Assignment 08/run_fifo.sh b/Assignment 08/run_fifo.sh new file mode 100644 index 0000000..89997ff --- /dev/null +++ b/Assignment 08/run_fifo.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +g++ fifo.cpp -o fifo.out +./fifo.out $1 $2 $3 $4 diff --git a/Assignment 08/run_lru.sh b/Assignment 08/run_lru.sh new file mode 100644 index 0000000..60f7f65 --- /dev/null +++ b/Assignment 08/run_lru.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +g++ lru.cpp -o lru.out +./lru.out $1 $2 $3 $4 +# 60 20 60 req1.dat \ No newline at end of file diff --git a/Assignment 08/run_random.sh b/Assignment 08/run_random.sh new file mode 100644 index 0000000..f2b4ef8 --- /dev/null +++ b/Assignment 08/run_random.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +g++ random.cpp -o random.out +./random.out $1 $2 $3 $4