5.4.5. Frame Allocation

5.4.5.1. Frames Needed by a Process

  • A process should allocate enough frames for its current locality.
  • If more frames are allocated, there is little improvement.
  • If less frames are allocated, there is a very high page fault rate.

Thrashing

A process is thrashing if it is spending more time paging than executing.

A thrashing process can cause other processes to thrash if a global page replacement strategy is used.


5.4.5.2. Dynamic Page Allocation

  • Demand Paging uses the locality model – the set of pages used for that particular phase of computation.
  • A process migrates from one locality to the next, as the process moves to a different phase of computation.
  • Dynamic paging algorithms attempt to adjust the memory allocation to match the process’ needs as it executes.
  • The Working Set algorithm is the best known algorithm for dynamic paging.

5.4.5.3. The Working Set Model

  • The working set for each model is the set of pages referenced by the process during the most recent $w$ page references.
  • Dynamic adjustment of $w$ is based on available memory, the number of processes and the page fault rate.
  • Based on the available memory and number of processes, we can establish upper and lower bounds on the desired page fault rate. If the actual page fault rate for the process exceeds the upper limit, then we can increase $w$ for the process. If the page fault rate falls below the lower limit, we decrease $w$.
  • The number of frames allocated to the process at anytime is the number of unique page references over the last $w$ references.
../../_images/working_set.png