Virtual Memory
Virtual Memory
Virtual Memory
Memory
Virtual Memory
Background
Demand Paging
Page Replacement
Allocation of Frames
Thrashing
Background
Demand paging
Demand segmentation
Demand Paging
Faster response
More users
Valid-Invalid Bit
valid-invalid bit
1
1
1
1
0
page table
0
0
Page Fault
algorithm
Performance of Demand
Paging
if p = 0 no page faults
Page Replacement
2.
3.
4.
Page Replacement
Page Replacement
Algorithms
First-In-First-Out (FIFO)
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
4 frames
9 page faults
10 page faults
Optimal Algorithm
4 frames example 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
1
6 page faults
3
4
Optimal Page
Replacement
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
1
Counter implementation
Page referenced:
LRU Approximation
Algorithms
Reference bit
Second chance
Clock replacement
Counting Algorithms
Allocation of Frames
fixed allocation
priority allocation
Fixed Allocation
Equal allocation For example, if there are 100 frames
and 5 processes, give each
process 20 frames
si size of process pi
m 64
si 10
s2 127
S si
10
a1
64 5
137
127
a2
64 59
137
Priority Allocation
Thrashing
Thrashing (Cont.)
End of
Chapter 9