Not Recently Used (NRU) page replacement algorithm
It is a page replacement algorithm. This algorithm removes a page at random from the lowest numbered non-empty class. Implicit in this algorithm is that it is better to remove a modified page that has not been referenced in atleast one clock tick than a clean page that is in heavy use.
It is easy to understand, moderately efficient to implement and gives a performance that while certainly not optimal, may be adequate. When page is modified, a modified bit is set. When a page needs to be replaced, the Operating System divides pages into 4 classes.
- 0:- Not Referenced, Not Modified
- 1:- Not Referenced, Modified
- 2:- Referenced, Not Modified
- 3:- Referenced, Modified
Out of above 4 categories, NRU will replace a Not Referenced, Not Modified page, if such page exists. Note that this algorithm implies that a Modified but Not Referenced is less important than a Not Modified and Referenced.
Example –
Page | Referenced | Modified |
---|---|---|
0 | 1 | 0 |
1 | 0 | 1 |
2 | 0 | 0 |
3 | 1 | 1 |
- Case-1 implies to Not Referenced and Modified.
- Case-2 implies to Not Referenced and Not Modified.
- Case-3 implies to Referenced and Modified.
- Case-0 implies to Referenced and Not Modified.
Algorithm :
From the given reference string NRU will remove a page at random from the lowest numbered nonempty class. Implicit in this algorithm is that it is better to remove a modified page that has not been referenced in at least one clock tick (typically 20 msec) than a clean page that is in heavy use.
Example –
Please Login to comment...