70 likes | 128 Views
Tutorial 9. Page Replacement Algorithms. In the following examples. A frame with a value of 0 is empty. A frame shown with an “=” sign holds the same value as it held in the previous time period. First in first out (FIFO). T he reference string of pages is 123472512645
E N D
Tutorial 9 Page Replacement Algorithms
In the following examples • A frame with a value of 0 is empty. A frame shown with an “=” sign holds the same value as it held in the previous time period
First in first out (FIFO) • The reference string of pages is 123472512645 • When a page must be replaced, the oldest page is chosen • page faults: 11
Optimal • The reference string of pages is 123472512645 • Replace the page that will not be used for the longest period of time • page faults: 7
Least recently used (LRU) • The reference string of pages is 123472512645 • When a page must be replaced , LRU choses the page that has not been used for the largest period of time • page faults: 10
Second chance When a page is used its use bit is set to 1. We also use a pointer to the next victim which is initialized to the first page/frame. When a page is loaded, it is set to point to the next frame. The list of pages is considered as a circular queue. When a page is considered for replacement, its use bit is examined. If it is zero [that page is replaced] otherwise [the use bit is set to zero, the next victim pointer is advanced, and the process repeated until a page is found with a zero use bit].
Second chance • 9 page faults.