0% found this document useful (0 votes)
22 views

Operating System - 3

When a program requests a memory page that is not currently loaded in physical memory, a page fault occurs. The operating system must then select an existing page to replace using a page replacement algorithm. FIFO replacement selects the oldest page in memory. Optimal replacement predicts which page will not be used for the longest time in the future. Least Recently Used replacement selects the page that has not been used for the longest period of time to replace. These algorithms aim to reduce the number of page faults by selecting pages less likely to be needed again soon.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Operating System - 3

When a program requests a memory page that is not currently loaded in physical memory, a page fault occurs. The operating system must then select an existing page to replace using a page replacement algorithm. FIFO replacement selects the oldest page in memory. Optimal replacement predicts which page will not be used for the longest time in the future. Least Recently Used replacement selects the page that has not been used for the longest period of time to replace. These algorithms aim to reduce the number of page faults by selecting pages less likely to be needed again soon.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

3.

In an operating system that uses paging for memory management, a page replacement algorithm is
needed to decide which page needs to be replaced when new page comes in.

Page Fault – A page fault is when a running program accesses a memory page that is mapped into
the virtual address space, but not loaded in physical memory.

Since actual physical memory is much smaller than virtual memory, page faults happen. In case of
page fault, Operating System might have to replace one of the existing pages with the newly needed
page. Different page replacement algorithms suggest different ways to decide which page to replace.
The target for all algorithms is to reduce the number of page faults.

First in First Out (FIFO)

This is the simplest page replacement algorithm. In this algorithm, the operating system keeps track
of all pages in the memory in a queue, the oldest page is in the front of the queue. When a page
needs to be replaced page in the front of the queue is selected for removal.

Optimal Page replacement

In this algorithm, pages are replaced which would not be used for the longest duration of time in the
future.

Least Recently Used

In this algorithm page will be replaced which is least recently used. When the page is the least of the
of those in memory, then when page replacement is to occur, this is the page that will be replaced
first.

You might also like