Allocation of Frames
• We cannot allocate more than the total
number of available frames (Unless there is
page sharing).
• We must also allocate at least a minimum
number of frames.
• Its obvious that
– Page Fault rate Increases as the number of frames
allocated to each process decreases, slowing down
process execution.
Allocation of Frames
• Each process needs minimum number of pages
• Two major allocation schemes
– fixed allocation
– priority allocation
Fixed Allocation
• Equal allocation – The easiest way to split ‘m’ frames among ‘n’
processes is to give equal share, m/n frames.
For example, if there are 100 frames and 5 processes, give each
process 20 frames.
• Proportional allocation – Allocate according to the size of
process
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
a1 64 5
137
127
a2 64 59
137
Priority Allocation
• Use a proportional allocation scheme using
priorities rather than size
• If process Pi generates a page fault,
– select for replacement one of its frames
– select for replacement a frame from a
process with lower priority number
Global vs. Local Replacement
• Global replacement – process selects a replacement
frame from the set of all frames; one process can take a
frame from another
• Local replacement – each process selects from only its
own set of allocated frames
Thrashing
• If a process does not have “enough” pages, the page-fault rate is
very high. This leads to:
– low CPU utilization
– operating system thinks that it needs to increase the degree
of multiprogramming
– another process added to the system
• Thrashing a process is busy swapping pages in and out
• Thrashing is greatly affected by Global Replacement.
• The effects of Thrashing can be limited by using Local
Replacement Algorithm.
Thrashing (Cont.)
Disk scheduling – Example problem
Suppose that a disk drive has 5000 cylinders, numbered 0 to
4999. The drive is currently serving a request at cylinder 143 and
the previous request was at cylinder 125. The queue of pending
request is 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130. What
is the total distance (in cylinders) to satisfy these requests using
the following disk-scheduling algorithms?
(i) FCFS
(ii) SSTF
(iii)SCAN
(iv)LOOK
(v)C-LOOK