Professional Documents
Culture Documents
Ch09 - Virtual Memory
Ch09 - Virtual Memory
Demand Paging
Process Creation
Page Replacement
Allocation of Frames
Thrashing
Demand Segmentation
Operating System Examples
9.2
Background
Virtual memory separation of user logical memory from physical
memory.
Demand paging
Demand segmentation
9.3
9.4
Virtual-address Space
9.5
9.6
Demand Paging
Bring a page into memory only when it is needed
Faster response
More users
9.7
9.8
Valid-Invalid Bit
Frame #
valid-invalid bit
1
1
1
1
0
0
0
page table
9.9
9.10
Page Fault
block move
9.11
9.12
algorithm
9.13
if p = 0 no page faults
+ restart overhead)
9.14
EAT = (1 p) x 1 + p (15000)
1 + 15000P
9.15
(in msec)
Process Creation
9.16
Copy-on-Write
Copy-on-Write (COW) allows both parent and child processes to
9.17
Page Replacement
Prevent over-allocation of memory by modifying page-fault service
9.18
9.19
2.
3.
Read the desired page into the (newly) free frame. Update the
page and frame tables.
4.
9.20
Page Replacement
9.21
1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
9.22
9.23
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
4 frames
9 page faults
10 page faults
9.24
9.25
9.26
Optimal Algorithm
Replace page that will not be used for longest period of time
4 frames example
1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
1
6 page faults
3
4
9.27
9.28
Counter implementation
9.29
9.30
link form:
Page referenced:
9.31
9.32
Second chance
Clock replacement
9.33
9.34
Counting Algorithms
Keep a counter of the number of references that have been
the smallest count was probably just brought in and has yet
to be used
9.35
Allocation of Frames
Each process needs minimum number of pages
Example: IBM 370 6 pages to handle SS MOVE instruction:
2 pages to handle to
fixed allocation
priority allocation
9.36
Fixed Allocation
Equal allocation For example, if there are 100 frames and 5
si size of process pi
S si
m total number of frames
s
ai allocation for pi i m
S
m 64
si 10
s2 127
10
64 5
137
127
a2
64 59
137
a1
9.37
frame from the set of all frames; one process can take a
frame from another
9.38
Thrashing
If a process does not have enough pages, the page-fault rate is
9.39
Thrashing (Cont.)
9.40
9.41
9.42
Working-Set Model
working-set window a fixed number of page references
9.43
Working-set model
9.44
Example: = 10,000
9.45
9.46
End of Chapter 9