Write a program to compare the performance of the lru and the optimal page replacement algorithms. the program will take a reference string and the number of frames as inputs. assume the maximum length of a reference string is 20 and there are 5 diffent pages from page 1 to page 5. the reference string can be randomly generated and the number of frames is entered through the keyboard. for example, the system generates a reference string 2 1 3 4 5 2 3 and you enter the number of frames 3. compare the number of page faults generated by the optimal and lru algorithms. print out the page replacement process and you can see how lru differs from the optimal.

Solved
Show answers

Ask an AI advisor a question