Unit-4 (Memory Management)
Unit-4 (Memory Management)
Memory Management
First-fit and best-fit better than worst-fit in terms of speed and storage
utilization
First-fit : P4 will not get space
Worst-fit
4
1
3 2
4
7,0,1,2,0,3,0,4,2,3,0,3,0,3,2,1,2,0,1,7,0,1
Graph of Page Faults Versus The Number of
Frames
Algorithm
Reference string:
7,0,1,2,0,3,0,4,2,3,0,3,0,3,2,1,2,0,1,7,0,1
3 frames (3 pages can be in memory at a time per
process)
15 page faults
Stack implementation
Keep a stack of page numbers in a double link form:
Page referenced:
move it to the top
requires 6 pointers to be changed
But each update more expensive
No search for replacement
LRU and OPT are cases of stack algorithms
that don’t have Belady’s Anomaly
Use Of A Stack to Record Most Recent Page References
Thrashing
If a process does not have “enough” pages,
the page-fault rate is very high
Page fault to get page
Replace existing frame
But quickly need replaced frame back
This leads to:
Low CPU utilization
Operating system thinking that it needs to increase
the degree of multiprogramming
Another process added to the system