ch10 Virtual Memory
ch10 Virtual Memory
Chapter 10
Virtual Memory
➢ Logical address
space can therefore
be much larger than
physical address
space
backing store
backing store
backing store
◆ After process 1
modifies page C
➔9 page faults
◆ Stack implementation
➢ Keep a stack of page numbers
in a double link form:
➢ Whenever page referenced,
move it to the top
✓ requires 6 pointers to be
changed at worst
➢ Each update little more
expensive
➢ No search for replacement
◆ Reference bit
➢ A bit associated with each entry in page table, initially = 0
➢ When page is referenced, the bit set to 1 by hardware
➢ Replace any with reference bit = 0 (if one exists)
➢ We can determine which pages have been used or not used, although
do not know the order
◆ Second-Chance algorithm
◆ Enhanced Second-Chance algorithm
◆ Additional-Reference-Bits algorithm
◆ If page to be replaced
has
➢ Reference bit = 0 ➔
replace it
➢ Reference bit = 1 ➔
✓ get second change
✓ set reference bit 0
✓ reset arrival time to
current time
◆ When page replacement called for, use the clock scheme but use
the four classes replace page in lowest non-empty class
➢ Might need to search circular queue several times
◆ Local replacement – each process selects from only its own set of
allocated frames
➢ More consistent per-process performance
➢ But possibly underutilized memory
◆ As degree of
multiprogramming
increases, CPU
utilization increases
until maximum is
reached
◆ If degree of
multiprogramming is
increased further,
thrashing sets in,
and CPU utilization
drops sharply
◆ Process's locality
changes over time
and may overlap
44
Working-Set Model 1
◆ based on assumption of locality
◆ : working-set window, a fixed number of page references
➢ Example: 10,000 instructions
◆ working set : set of pages in the most recent page references
➢ Process is actively using the pages in its working set
➢ approximation of program's locality
➢ Program 2
int[128,128] data;
for (i = 0; i < 128; i++)
for (j = 0; j < 128; j++) ➔ 128 page faults
data[i,j] = 0;