Demand Paging
Demand Paging
Demand Paging
Demand Paging
Virtual Memory
• Is a technique that allows the execution of Ps that
may not be completely in memory.
• Advantage of this scheme is that programs can be
larger than physical memory.
• Ps to share files and address spaces.
• Benefits:
1. No constraint of the physical memory.
2. More programs can be run at the same time.
3. Less I/O would be needed.
VM is the separation of user logical memory
from physical memory.
Demand Paging
• Virtual memory is implemented by demand
paging.
• It is similar to a paging system with swapping.
Lazy swapper
• A lazy swapper never swaps a page into memory
unless that page will be needed.
• When a process to be swapped in, the pager
guesses which pages will be used before the
process is swapped out again.
• Instead of swapping the whole process, the
pager brings only those necessary pages into
memory.
• Valid-invalid bit is used. PT(1-BIT)=v,i
Access to a page marked “invalid” causes a
page-fault trap.
Pure demand paging
• Bring each page into memory until is required.
• Multiple page faults.
• The hardware support for demand paging is:
• Page table
• Secondary pages
Performance of demand paging
• Compute the effective memory access time.
• Memory access time, ma, 10 to 200 nano secs
Page Replacement
• Each page has faulted atmost once, when it is
first referenced.
• P=10/2=5 pages (only uses only one-half)
• If we need 40 frames, we could run 8
processes, ,…….degree of MP
Basic scheme
Page Replacement Algorithms
1. FIFO Page Replacement (oldest page is chosen)
Belady’s Anamoly
• The page fault rate may increase as the
number of frames increases.