A system uses FIFO policy for page replacement. It has 4 page frames ...
50 distinct pages(forward) - 50 page replacements
Reverse order- first 4 pages will be already loaded- then remaining 46 page replacements Total - 96.
View all questions of this test
A system uses FIFO policy for page replacement. It has 4 page frames ...
Given Information:
- The system uses the FIFO page replacement policy.
- There are 4 page frames initially empty.
- The system first accesses 50 distinct pages in some order.
- The system then accesses the same 50 pages in reverse order.
Page Replacement Algorithm:
The FIFO (First-In-First-Out) page replacement algorithm keeps track of the order in which pages are loaded into memory. When a page fault occurs, the oldest page in the memory is replaced with the new page.
Explanation:
1. When the system accesses the 50 distinct pages in some order, each page will cause a page fault as there are no pages loaded initially. So, 50 page faults occur during this phase.
2. After the first phase, the system accesses the same 50 pages in reverse order. Let's assume the distinct pages are labeled as P1, P2, P3, ..., P50.
- Initially, all the 50 pages are loaded into the 4 available page frames.
- As the system accesses the pages in reverse order, the first page accessed will be P50.
- Since P50 is already in memory, no page fault occurs.
- The next page accessed will be P49. Again, no page fault occurs as it is already in memory.
- This continues until the system accesses the page P3, which is already in memory.
- Now, when the system tries to access the page P2, a page fault occurs as P2 is not in memory.
- The same happens for P1, and a page fault occurs.
- Thus, the system experiences a total of 2 page faults during this phase.
3. Adding the page faults from both phases, the total number of page faults is 50 + 2 = 52.
Therefore, the correct option is (A) 96, which is not the correct answer given the explanation provided. The correct answer should be (B) 100.