Placement Policies

Tom Kelliher, CS 240

Apr. 24, 2000

Administrivia

Announcements

Homework questions?

Assignment

Read 8.1--3.

From Last Time

Replacement policies: FIFO, Optimal, LRU.

Outline

  1. Implementing LRU. Second chance FIFO.

  2. Placement policies.

Coming Up

I/O.

Replacement Policies

LRU Implementation

  1. Maintain frame list as a ``stack.'' Implementation?

  2. Timestamp page table entry on each access. Implementation?

  3. Simulating the time stamp through recording and concatenation of reference bits.
    1. Implementation: system daemon and timer interrupt.

    2. How often to record?

    3. How many bits?

Second Chance FIFO

AKA clock algorithm.

  1. Maintain process' frame list in a circular queue.

  2. The ``victim'' pointer.

  3. Victim page referenced: skip over, resetting reference bit.

  4. All pages referenced: pure FIFO.

  5. Enhancement: examine (reference bit, dirty bit):
    1. Four combinations --- priorities?

    2. Possibly several passes through the queue.

Placement Policies

How are frames allocated to processes?

Issues:

  1. Minimum # of frames.

  2. Static vs. dynamic policies.

  3. Global vs. local.

  4. Thrashing.

  5. Optimizations.

  6. Interaction with I/O subsystem.

Minimum Number of Frames

Must have sufficient frames in memory to execute an instruction.

Requirements:

  1. Instruction fetch: One or two frames.

  2. Operand fetch/store: One or two frames per operand.

  3. Massive indirection?

Simple Allocation Policies

  1. Equal allocation.
    1. How realistic?

  2. Proportional allocation.
    1. Allocated space according to need.
      1. Process i needs pages.

      2. Total need is pages.

      3. Memory broken into m frames.

      4. Process i granted frames.

    2. How realistic?

    3. Can be generalized to priority schemes.

Problems with static policies.

Suppose we re-adjusted proportional at intervals. Any improvement?

Global and Local Replacement

If a victim page must be selected, what is the candidate pool?

  1. Local: page frames of only the faulting process.

    Process' fault rate not dependent on other process' behavior.

  2. Global: any page frame.
    1. Frame stealing.

    2. Interdependence of processes.

  3. Combined policy (prioritized).

Thrashing

  1. Effect of CPU utilization on degree of multiprogramming.

  2. Effect of degree of multiprogramming on frame distribution.

  3. Effect of frame distribution on page fault rate.

  4. Effect of page fault rate on CPU utilization.

CPU utilization low due to paging, so more processes started, making memory situation worse, leading to more paging, lowering CPU utilization, so more processes started, ...

Adaptive Allocation Policies

Attempt to adapt to process behavior.

Action on memory over-commitment?

Working Set Model

Idea:

  1. ``Locality.''

  2. Number of pages for each locality.

  3. This is the working set.

How do we determine the working set?

  1. : working set window.

  2. : working set interval.

  3. Every time units, examine last references and determine number of unique references. That number is the working set size.

  4. How do we implement this?
    1. System daemon and timer interrupt.

    2. Concatenate a few reference bits.

  5. What happens if the window straddles two localities, etc.? (Working set aliasing)

Page Fault Frequency

  1. Ultimate goal: maintain each process' page fault rate within some target region.

  2. Implementation: Track each process' fault rate
    1. If above target region: allocate more frames to process.

    2. If below target regions: de-allocate frames.

  3. Implementation?



Thomas P. Kelliher
Mon Apr 24 08:12:00 EDT 2000
Tom Kelliher