Page Replacement Algorithms
Page Replacement Algorithms
Each operating system uses different page replacement algorithms. To select the particular algorithm,
the algorithm with lowest page fault rate is considered.
1.Optimal page replacement algorithm
2.Not recently used page replacement
3.First-In, First-Out page replacement
4.Second chance page replacement
5.Clock page replacement
6.Least recently used page replacement
Issues:
•poor replacement policy
•FIFO doesn't consider the page usage.
Although LRU is theoretically realizable, it is not cheap. To fully implement LRU, it is necessary to
maintain a linked list of all pages in memory, with the most recently used page at the front and the least
recently used page at the rear. The difficulty is that the list must be updated on every memory
reference. Finding a page in the list, deleting it, and then moving it to the front is a very time-
consuming operation, even in hardware (assuming that such hardware could be built).
The Not Recently Used Page Replacement Algorithm
Two status bit associated with each page. R is set whenever the page is referenced (read or written). M
is set when the page is written to (i.e., modified).
When a page fault occurs, the operating system inspects all the pages and divides them into four
categories based on the current values of their R and M bits:
Class 0: not referenced, not modified.
Class 1: not referenced, modified.
Class 2: referenced, not modified.
Class 3: referenced, modified.
The NRU (Not Recently Used) algorithm removes a page at random from the lowest numbered
nonempty class.
When a page fault occurs, the page being pointed to by the hand is inspected. If its R bit is 0, the page
is evicted, the new page is inserted into the clock in its place, and the hand is advanced one position. If
R is 1, it is cleared and the hand is advanced to the next page. This process is repeated until a page is
found with R = 0
Source : http://dayaramb.files.wordpress.com/2012/02/operating-system-pu.pdf