Page Replacement Tecnique Os c5
Page Replacement Tecnique Os c5
Page Replacement Tecnique Os c5
TECNIQUE
OS COMPONENT 5
SHRI RAAM S
22BCA056
II BCA A
INTRODUCTION
• Page replacement is needed in the operating systems that use virtual memory
using Demand Paging. As we know that in Demand paging, only a set of pages
of a process is loaded into the memory. This is done so that we can have more
processes in the memory at the same time.
• When a page that is residing in virtual memory is requested by a process for its
execution, the Operating System needs to decide which page will be replaced
by this requested page. This process is known as page replacement and is a vital
component in virtual memory management.
Why Need Page Replacement
Algorithms?
• Page Fault: A Page Fault occurs when a program running in CPU tries to access a
page that is in the address space of that program, but the requested page is currently
not loaded into the main physical memory, the RAM of the system.
• Since the actual RAM is much less than the virtual memory the page faults occur. So
whenever a page fault occurs, the Operating system has to replace an existing page in
RAM with the newly requested page. In this scenario, page replacement algorithms
help the Operating System in deciding which page to replace. The primary objective
of all the page replacement algorithms is to minimize the number of page faults.
First In First Out (FIFO)
• This is the Last in First Out algorithm and works on LIFO principles. In
this algorithm, the newest page is replaced by the requested page. Usually,
this is done through a stack, where we maintain a stack of pages currently
in the memory with the newest page being at the top. Whenever a page
fault occurs, the page at the top of the stack is replaced.