Question: 1 Objectives Th memory system using the three p age replace is programming assignment is to simulate a simple virtual ment policies studied in class:



1 Objectives Th memory system using the three p age replace is programming assignment is to simulate a simple virtual ment policies studied in class: First-In First-Out (FIFO), Optimal, and Least Recently Used (LRU). Your program reads an input file containing a sequence of page requests (page numbers) and generates an output that shows how the reque sted pages are mapped into physical frames. 2 Description The page replace ment algorithms to implement in this assignment are First-In First-Out (FIFO), Optimal, and Least Recently Used (LRU). The detailed algorithms are already described in class slides and textbook Chapter 9 2.1 Task Information The page request information will be read from an input file. The first line in the input file has three integers. The first integer is the number of pages, the second integer is the number of frames, and the third integer is the number of page access requests. The remaining lines in the input file are page access requests (page numbers), with each page request appearing on a separate line. In an interesting input, the number of frames is less than the number of pages; otherwise, the problem is trivial. Furthermore, in an interesting input, some pages are requested multiple times (the same page number appears multiple times in the sequence). Because the number of frames is typically smaller than the number of pages, the same page may be mapped to a different frame each time it is requested. In your simulation, assume pure demand paging, that is, pages are loaded into physical frames only when they are requested. So, initially, no pages are loaded, and all frames are free. If the number of frames is x, the first x acce When a request to access the ?1)-th page arrives, your program must find one of the x pages that have been loaded into physical frames and replace it with the new page. The selection of the page to be replaced depends on the page replacement policy. pages accesed will be trivially mapped to t x frames without having to replace any pages. In the FIFO policy, the first page loaded into a physical frame is se lected for replacement. In the Optimal policy, the page that will not be accessed for the longest time in the future is selected for replacement. This policy may be implemented by associating with each page table entry a number indicating its next-use time in the future. When replace ment is needed, replace the page with the greatest next-use number. If a page is not referenced in the future, set its next-use time to INFINITY. 1 Objectives Th memory system using the three p age replace is programming assignment is to simulate a simple virtual ment policies studied in class: First-In First-Out (FIFO), Optimal, and Least Recently Used (LRU). Your program reads an input file containing a sequence of page requests (page numbers) and generates an output that shows how the reque sted pages are mapped into physical frames. 2 Description The page replace ment algorithms to implement in this assignment are First-In First-Out (FIFO), Optimal, and Least Recently Used (LRU). The detailed algorithms are already described in class slides and textbook Chapter 9 2.1 Task Information The page request information will be read from an input file. The first line in the input file has three integers. The first integer is the number of pages, the second integer is the number of frames, and the third integer is the number of page access requests. The remaining lines in the input file are page access requests (page numbers), with each page request appearing on a separate line. In an interesting input, the number of frames is less than the number of pages; otherwise, the problem is trivial. Furthermore, in an interesting input, some pages are requested multiple times (the same page number appears multiple times in the sequence). Because the number of frames is typically smaller than the number of pages, the same page may be mapped to a different frame each time it is requested. In your simulation, assume pure demand paging, that is, pages are loaded into physical frames only when they are requested. So, initially, no pages are loaded, and all frames are free. If the number of frames is x, the first x acce When a request to access the ?1)-th page arrives, your program must find one of the x pages that have been loaded into physical frames and replace it with the new page. The selection of the page to be replaced depends on the page replacement policy. pages accesed will be trivially mapped to t x frames without having to replace any pages. In the FIFO policy, the first page loaded into a physical frame is se lected for replacement. In the Optimal policy, the page that will not be accessed for the longest time in the future is selected for replacement. This policy may be implemented by associating with each page table entry a number indicating its next-use time in the future. When replace ment is needed, replace the page with the greatest next-use number. If a page is not referenced in the future, set its next-use time to INFINITY
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
