Modeling Page Replacement Algorithms
Modeling Page Replacement Algorithms
FIFO with 3 page frames FIFO with 4 page frames P's show which page references show page faults
Stack Algorithms
Contd..
Paging system can be categorized by 3 items: 1. The reference string of executing process 2. the page replacement algorithm 3. the number of page frames available in memory i.e. m M- internal array keeps track of state of memory Top part- all the page entries currently in memory Bottom part- pages referenced once, swapped out and are not in memory
Contd..
C number of occurrences of i or infinity in distance string F number of page faults
Local when a process gets page fault , the page replacement algorithm try to find the LRU page considering pages that are currently allocated to only that process. Global if the page with lowest age value is removed without regard to whose page it is.
Contd..
Local allocates fixed memory to process. If working set grows thrashing will result. So wasting memory. Global dynamical allocation among runnable processes. Here OD continually decides how many page frames to assign to each process. Page Fault Frequency (PFF) algorithm: Tells when to increase or decrease process page allocation but not which page to remove
Load Control
Despite good designs, system may still thrash When PFF algorithm indicates
some processes need more memory but no processes need less
Disadvantages
programs need many pages, larger page tables
Shared Pages
Contd..
If I space and D space are supported 2 or more processes use the same page table for their I space but different D space. Processes share same code problem occurs Copy-on-write: Those pages that are never written need not be copied.
Cleaning Policy
Need for a background process, paging daemon
periodically inspects state of memory
It can use same circular list (clock) front hand controlled by paging daemon Back hand page replacement
Segmentation
Segmentation (1)
One-dimensional address space with growing tables One table may bump into another
Segmentation (2)
Segmentation (3)