Program that implements the fifo and lru


Project: Management

Write a program that implements the FIFO and LRU page-replacement algorithms presented in the chapter of Virtual Memory. First, generate a random page-reference string where page numbers range from 0 to 9. Apply the random page-reference string to each algorithm, and record the number of page faults incurred by each algorithm. Implement the replacement algorithms so that the number of page frames can vary as well. Assume that demand paging is used. Your algorithms will be based on the abstract class called “ReplacementAlgorithm”.

Design and implement two classes – LRU and FIFO – that extend ReplacementAlgorithm. Each of these classes will implement the insert() method, one class using the LRU page-replacement algorithm and the other using the FIFO algorithm.

There are two classes available to test your algorithm:

a. PageGenerator -  a class that generates page-reference strings with page numbers ranging from 0 to 9. The size of the reference string is passed to the PageGenerator constructor. Once a PageGenerator object is constructed, the getReferenceString() method returns the reference string as an array of integers.

b. Test- used to test your FIFO and LRU implementations of the ReplacementAlgorithm abstract class.

Test is invoked as:

java Test < # of page frames>

Once you have implemented the FIFO and LRU algorithms, experiment with a different number of page frames for a given reference string and record the number of page results. Does one algorithm perform better than the other?  For a given reference-string size, what is the optimal number of page frames?

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: Program that implements the fifo and lru
Reference No:- TGS01238268

Expected delivery within 24 Hours