Question-1 Explain NRU (Not Recently Used) Page Replacement Algorithm
NRU (Not Recently Used)
- NRU makes approximation to replace the page based on R and M bits.
- When a process is started up, both page bits for all pages are set to 0 by operating system.
- Periodically, the R bit is cleared, to distinguish pages that have not been referenced recently from those that have been.
- When page fault occurs, the operating system inspects all the pages and divide them into 4 categories based on current values of their R and M bits
- Case 0 : not referenced, not modified
- Case 1 : not referenced, modified
- Case 2 : referenced, not modified
- Case 3 : referenced, modified
- The NRU (Not Recently Used) algorithm removes a page at random from the lowest numbered nonempty class.
- In given example,
- Page-0 is of class-2 (referenced, not modified)
- Page-1 is of class-1 (not referenced, modified)
- Page-2 is of class-0 ( not referenced, not modified)
- Page-3 is of class-3 (referenced, modified)
So lowest class page-2 needs to be replaced by NRU.
You may be interested in:
Operating System Short Descriptive Questions and Answers