An implementation of a class memory_manager is available here (also attached to project). This class implements a simulator for a memory manager. One key method in this implementation is page_fault(), which takes as input the number of the virtual page, page_requested, that caused a page fault on a full RAM, as well as the time, clock_tick, at which the fault occurred.

Modify the implementation of method page_fault() to implement a page replacement algorithm of your choice. You may want to consider Least Recently Used, FIFO, or any other algorithm you would like to try your hand at.


Unless you would like to also try a fancy algorithm that explicitly assigns priorities to pages (or cares whether the page reference is a READ request or a WRITE request), or increase the size of your virtual address space or that of your RAM, only the page_fault() method should be modified to implement your chosen algorithm. Your might need to use one or more additional data members for yourmemory_manager class to keep track of state information that the memory manager needs to make a replacement decision.

Collectively, the data members PHYSICAL_MEMORY, LOAD, TIME_IN_RAM, and REFERENCES (the purpose of each of which is documented within the source code) simulate our page table and should be modified, if needed, from within the page_fault() method to put the page table in a consistent state after a slot in RAM is picked by your algorithm to evict an already mapped virtual page and replace it with the offending page. The current implementation of page_fault() simply evicts the first page (i.e., at index 0) currently RAM and replaces it with the offending one.

You may try a different list of page requests (by assigning it to the page_requests data member that is defined immediately above main()) to test your algorithm.

Save the source file as and attach it to your post. Please be sure that your source code is compilable and be sure to indicate the JDK that you have used to test your program.

What page replacement algorithm did you choose to implement? Describe a situation for which this algorithm may not be suitable (e.g., you are using NRU but you know that a heavy use of the first half of the virtual address space will be followed by a very light use of some of the pages in the second half of the virtual address space, which will be followed by a very heavy need for the first half of the virtual address space). How would you optimize your algorithm for this particular situation?

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.