Demand paging
Page-fault handling, animated.
Module 4
Session 4.5
Lesson 1 of 1
Demand Paging and Page Faults
Do not load a page until it is touched. A fault is the mechanism, not necessarily an error.
The valid bit
If the page is in RAM, the PTE is valid and holds a frame. If it is on backing store, valid=0. The first reference traps: save the process, find a frame, schedule disk I/O, restart the instruction.
Effective access time ≈ (1−p)·tmem + p·tfault. If tfault is 8 ms and tmem is 100 ns, even p = 0.001 dominates. Locality is why this works.
EAT calculator
- Trap to kernel; save user registers.
- Check PTE: illegal → kill; valid=0 but on swap → continue.
- Allocate a frame (maybe replace, next session).
- Read the page from disk; I/O wait.
- Set valid bit; restart the instruction.