0% found this document useful (0 votes)
958 views

Modeling Page Replacement Algorithms

The document discusses various page replacement algorithms and design issues for paging systems. It covers Belady's Anomaly with FIFO examples, stack algorithms, the distance string for predicting page faults, local versus global allocation policies, load control, page size tradeoffs, separate instruction and data spaces, shared pages using copy-on-write, cleaning policies, and segmentation compared to paging. The key topics are modeling page replacement algorithms, predicting page faults, and design considerations for paging systems.

Uploaded by

Louis Yap
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
958 views

Modeling Page Replacement Algorithms

The document discusses various page replacement algorithms and design issues for paging systems. It covers Belady's Anomaly with FIFO examples, stack algorithms, the distance string for predicting page faults, local versus global allocation policies, load control, page size tradeoffs, separate instruction and data spaces, shared pages using copy-on-write, cleaning policies, and segmentation compared to paging. The key topics are modeling page replacement algorithms, predicting page faults, and design considerations for paging systems.

Uploaded by

Louis Yap
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Modeling Page Replacement Algorithms

I.S.L Sarwani, Asst prof, IT, ANITS

Modeling Page Replacement Algorithms Belady's Anomaly

FIFO with 3 page frames FIFO with 4 page frames P's show which page references show page faults

Stack Algorithms

State of memory array, M, after each item in reference string is processed

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

The Distance String


A page reference will be denoted by the distance from top of stack where reference page was located. Pages that have not yet been reference distance infinity. Distance string depends on reference string and paging algorithm.

Predicting page fault rates

Computation of page fault rate from distance string


the C vector the F vector

Contd..
C number of occurrences of i or infinity in distance string F number of page faults

Design issues for paging systems

Local versus Global Allocation Policies (1)

Original configuration Local page replacement Global page replacement

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

Solution : Reduce number of processes competing for memory


swap one or more to disk, divide up pages they held reconsider degree of multiprogramming

Page Size (1)


Small page size Advantages
less internal fragmentation better fit for various data structures, code sections less unused program in memory

Disadvantages
programs need many pages, larger page tables

Separate Instruction and Data Spaces

One address space Separate I and D spaces

Shared Pages

Two processes sharing same program sharing its page table

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

When too few frames are free


selects pages to evict using a replacement algorithm

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)

Allows each table to grow or shrink, independently

Segmentation (3)

Comparison of paging and segmentation

Implementation of Pure Segmentation

(a)-(d) Development of checkerboarding (e) Removal of the checkerboarding by compaction

You might also like