Question: Objective: To implement page-replacement algorithms used by the operating system. Background: If total memory requirements exceed the physical (main) memory, then it is necessary to

Objective: To implement page-replacement algorithms used by the operating system.

Background: If total memory requirements exceed the physical (main) memory, then it is necessary to replace pages from memory to free frames for new pages. Various page-replacement algorithms exist. Three common algorithms are First-In-First-Out (FIFO), Optimal (OPT), and Least-Recently-Used (LRU).

Project Task: Write a program (in Java) that implements the FIFO, OPT and LRU page-replacement algorithms. Use the following page-reference string:

0, 1, 2, 3, 2, 4, 5, 2, 4, 1, 6, 3, 7, 8, 3, 8, 4, 9, 7, 8, 1, 2, 9, 6, 4, 5, 0, 2, 5, 1, 9

where page numbers range from 0 to 9. Assume that the number of page frames is 4. Implement these three replacement algorithms, and record the number of page faults incurred by each algorithm. Assume that demand paging is used, i.e., all page frames are initially free. To ensure that your program produces correct output, you can calculate the numbers of page faults by hand and compare them with the outputs.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!