Page Replacement Algorithms

7,332 views

Published on

Page Replacement Algorithms

  • It's been so useful
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Page Replacement Algorithms

  1. 1. Page replacement algorithms Ubaidullah alias kashif MSCCN-III Sukkur IBA.
  2. 2. Paging:- In computer operating systems, pagingis one of the memory-management schemes bywhich a computer can store and retrieve datafrom secondary storage for use in mainmemory.Page fault The main functions of paging areperformed when a program tries to accesspages that are not currently mapped to physicalmemory (RAM). This situation is known as apage fault.
  3. 3. Page replacement algorithmPage replacement algorithms decide whichmemory pages to page out (swap out, writeto disk) when a page of memory needs to beallocated. Paging happens when a page fault occurs anda free page cannot be used to satisfy theallocation, either because there are none, orbecause the number of free pages is lowerthan some threshold.
  4. 4. ClockThe clock algorithm keeps a circular list of pages inmemory, with the "hand" (iterator) pointing to the lastexamined page frame in the list.
  5. 5. When a page fault occurs and no empty frames exist, then the R(referenced) bit is inspected at the hands location. If R is 0, thenew page is put in place of the page the "hand" pointsto, otherwise the R bit is cleared. Then, the clock hand isincremented and this process is repeated until a page is foundwith R = 0
  6. 6. LRU & NRULRU keeps track of page usage over a short period oftime, while NRU just looks at the usage in the lastclock interval.
  7. 7. Adaptive replacement cacheARC improves the basic LRU strategy by splitting thecache directory into two lists, T1 and T2, for recentlyand frequently referenced entries.In turn, each of these is extended with a ghost list (B1or B2), which is attached to the bottom of the twolists. These ghost lists act as scorecards by keepingtrack of the history of recently evicted (expelled)cache entries, and the algorithm uses ghost hits toadapt to recent change in resource usage.
  8. 8. T1, for recent cache entries.T2, for frequent entries, referenced at least twice.B1, ghost entries recently evicted from the T1 cache, but are stilltracked.B2, similar ghost entries, but evicted from T2.T1 and B1 together are referred to as L1, a combined history ofrecent single references. Similarly, L2 is the combination of T2and B2
  9. 9. ...[ B1 <-[ T1 <-!-> T2 ]-> B2 ] . …. [ ……………. . . . [ . . . . . . ! . .^. …………...... ] …… . . . ] [ fixed cache size (c) ]

×