Write a program in C++ that implements the FIFO and LRU page-replacement algorit
ID: 3554354 • Letter: W
Question
Write a program in C++ that implements the FIFO and LRU page-replacement
algorithms. Use the following page-reference string:
0, 1, 2, 3, 2, 4, 5, 3, 4, 1, 6, 3, 7, 8, 7, 8, 4, 9, 7, 8, 1, 2, 9, 5, 4, 5, 0, 2
where page numbers range from 0 to 9. Record the number of page faults incurred by each
algorithm. Implement the replacement algorithms so that the number of page frames can vary
from 1 to 5. Assume that demand paging is used, i.e., page frames are initially free. To ensure
that your program produces correct output, you can calculate the number of page faults for a
given number of frames (say, three) by hand and compare it with the output.
Explanation / Answer
C Program for Simulation of Page replacement algorithms
(FIFO, LRU, Optimal)
#include
void FIFO(char [],char [],int,int);
void lru(char [],char [],int,int);
void opt(char [],char [],int,int);
int main()
{
int ch,YN=1,i,l,f;
char F[10],s[25];
clrscr();
//system(
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.