The Page Replacement strategies deal with which pages need
to be swapped out and which are the ones that need to be swapped in or brought
in to the memory from the backing store. The efficiency of a page replacement
strategy lies in the least time that is wasted for a page to be paged in to the
memory from the backing store and with the minimum IO. Page Replacement
algorithms can be either of the following two.
·
Local Page Replacement Strategy
·
Global Page Replacement Strategy
In a Local replacement strategy, the Operating System decides
on the number of pages to be allocated to a process on a process-to-process
basis. Hence, this is process specific and each process can handle the page
faults that can occur. The page that has to be swapped out from the memory is
taken from the same process. In the Global Replacement strategy however, the
Operating System allocates a fixed number of pages to each of the processes
irrespective of the specific memory requirements of a particular process. As
far as Page Replacement is concerned, the Operating System decides to swap out
a page that belongs to any of the processes that are loaded in the memory.
There are many Page replacement algorithms of which the most
commonly used are the following:
·
Last In First Out (LIFO)
·
Least Recently Used (LRU)
·
Not Recently Used (NRU)
The LIFO page replacement strategy decides to replace the page
that has been swapped in to the memory last. Therefore, it works in a LIFO
principle (similar to how a stack works). The LRU page replacement algorithm
is an algorithm which swaps the pages that have been used the least over a
period of time. The NRU page replacement algorithm is an algorithm which swaps
the pages that have not been recently used over a period of time.