What is demand paging?
A technique where pages are loaded into memory only when they are first accessed.
What triggers a page fault?
Accessing a page that is not currently in physical memory.
First step in handling a page fault?
Validate the memory address to ensure the reference is legal.
Second step in handling a page fault?
If the reference is invalid, terminate the process; otherwise, page must be brought into memory.
Third step in handling a page fault?
Find a free frame in physical memory.
Fourth step in handling a page fault?
Read the required page from disk into the free frame.
Fifth step in handling a page fault?
Update the page table to mark the page as valid and in memory.
Final step in handling a page fault?
Restart the instruction that caused the page fault.
What is pure demand paging?
A system where no pages are loaded until they are accessed.
Why can one instruction cause multiple page faults?
Because the instruction, operands, or data may span multiple pages.
What is Effective Access Time (EAT)?
The average time to access memory considering page faults.
Formula for EAT?
EAT = (1 - p)memory_access + p(page fault overhead).
What is page fault rate p?
The probability (0 to 1) that a memory access will cause a page fault.
Why does a small p increase EAT significantly?
Page faults are extremely slow compared to normal memory accesses.
What is Copy-On-Write (COW)?
A technique where pages are shared until a write occurs, then a private copy is made.
When is Copy-On-Write used?
During fork() so parent and child share pages until modified.
What is page replacement?
Selecting a page to evict when no free frames exist and a new page must be loaded.
Why is page replacement necessary?
Because memory is limited and all frames may be full when a new page is needed.
What is a dirty/modify bit?
A bit that indicates whether a page has been modified since it was loaded.
Why use a dirty bit?
To avoid writing unchanged (clean) pages back to disk, saving time.
What is a reference string?
A sequence of page numbers representing the order of memory accesses.
What is a page access string?
Another name for the reference string used in replacement algorithms.
How do we evaluate a replacement algorithm?
Count how many page faults occur for a given reference string.
What is Belady’s Anomaly?
When increasing the number of frames causes more page faults under FIFO.