Virtual Memory Management
Virtual Memory Management
• Background
• Demand Paging
• Copy-on-Write
• Page Replacement
• Allocation of Frames
• Thrashing
What is Virtual Memory?
• Technique that allows the execution
of processes that are not completely
in memory.
• Abstracts main memory into an
extremely large, uniform array of
storage.
• Allows processes to share files easily
and to implement shared memory.
Background
• For a program to get executed the
entire logical address space should
be placed in physical memory
• But it need not be required or also
practically possible. Few examples
are
– Error codes seldom occur
– Size of array is not fully utilized
– Options and features which are rarely
used
Virtual
memory is
implemented
using DEMAND
PAGING
Demand Paging
• Bring a page into memory only when it is needed
– Less I/O needed
– Less memory needed
– Faster response
– More users
i
i
page table
Page faults:15
Page replacements:12
Adv and Disadv of FIFO
Adv
Easy to understand and program
Disadv
• Performance not always good
• The older pages may be
initialization files which would be
required throughout
• Increases the page fault rate and
slows process execution.
What is belady’s anomaly
123412512345
Compute using 4 frames
Compare the page faults by using
frame size 3
Difference is because of belady’s
anomaly
Optimal Algorithm
• Result of discovery of Belady’s
anomaly was optimal page
replacement algorithm
• Has the lowest page-fault rate of all
algorithms
• Algorithm does not exist. Why?
Optimal Page Replacement