Question-1 Explain The Clock Page Replacement Algorithm
The Clock Page Replacement Algorithm
- Although second chance is a reasonable algorithm, it is unnecessarily inefficient because it is constantly moving pages around on its list.
- A better approach is to keep all the page frames on a circular list in the form of a clock, as shown in Fig. below.
- A hand points to the oldest page.
- When a page fault occurs, the page being pointed to by the hand is inspected.
Figure- The clock page replacement algorithm.
- 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. Not surprisingly, this algorithm is called clock.
- It differs from second chance only in the implementation.