4.5 Modeling page replacement algorithms Belady’s anomaly Intuitively, the more page frames we have the better (i.e., less page faults). This is NOT always true for all page replacement algorithms! Ex. FIFO exhibits Belady’s anomaly; LRU does not. FIFO and Belady’s anomaly Characterizing page replacement algorithms 1. 2. 3. 4. Reference string (ordered list of pages referred to by a process as it executes) Page replacement algorithm m=number of page frames available in memory M=set of pages currently in memory Ex. LRU { { M not in memory Stack algorithms Algorithms which exhibit: M m,r M m1,r where M is the set of pages currently in memory, m is the number of page frames, and r is the rth memory reference in the reference string. LRU has this property; FIFO does not. Stacking algorithms do NOT suffer from Belady’s anomaly. Distance string distance from top of stack top not present Distance string More normal distribution (left) satisfied w/ k page frames than uniform (right). Predicting page fault rates 20 18 17 13 11 9 8 n Fm Ck C k m1