previous
 next 
CS 3733 Operating Systems Notes: Page Replacement
(change semester)

When a page is replaced you need to know whether the replaced page has been modified.

Four Page Replacement Algorithms

1: FIFO - first-in-first-out Example
Calculate the number of page faults obtained for the following page reference sequence:
     1,2,3,4,1,2,5,1,2,3,4,5
When:
  1. The memory has 3 frames: ans: 1,2,3,4,1,2, 5,1,2,3,4,5 (9 faults)
  2. The memory has 4 frames: ans: 1,2,3,4,1,2,5,1,2,3,4,5 (10 faults)
This is sometimes called Belady's anomaly.

2: Optimal Replacement
Look to the future.
Impossible to implement, but gives the best possible result.
Example:
Optimal with three frames: 1,2,3,4,1,2,5,1,2,3,4,5
7 page faults.


3: Least Recently Used

Example:
LRU with three frames: 1,2,3,4,1,2,5,1,2,3,4,5
10 page faults.

Least Recently Used Approximations
Using a reference bit (idea):


4: Second Chance = FIFO + reference bit


Next Notes

Back to CS 3733 Notes Table of Contents