- 2072 Asoj · 3+6 marks
Page fault, demand paging, address translation
Short answer
A page fault occurs when a referenced page is not in memory; demand paging loads pages only on demand. For logical address 18325, page number 2 maps to frame 11, giving physical address 92053.
Define page fault and demand paging. Consider a paged memory system with eight pages of 8KB page size each and 16 page frames in memory. Using the given page table, compute the physical address for the logical address 18325.
| Page | Frame |
|---|---|
| 7 | 10 |
| 6 | 4 |
| 5 | 0 |
| 4 | 7 |
| 3 | 13 |
| 2 | 11 |
| 1 | 14 |
| 0 | 5 |
Page fault
A page fault is a trap generated by the MMU when a process references a page which is not present in main memory. The OS loads the page from disk into a free frame, updates the page table and restarts the instruction.
Demand paging
In demand paging a page is brought into memory only when it is demanded (referenced) for the first time, rather than loading the whole program at start. A valid/invalid bit in each page-table entry shows if the page is in memory. A reference to an invalid page causes a page fault, which the OS services. Advantages: less I/O, less memory used per process, faster start, more processes in memory. This scheme is called "lazy swapping" using a pager.
Address translation
- Page size = 8 KB = 8192 bytes (13-bit offset). 8 pages = 64 KB logical space (16-bit logical address: 3 bits page + 13 bits offset). 16 frames = 128 KB physical memory (17-bit physical address: 4 bits frame + 13 bits offset).
- Logical address = 18325.
- Page number = 18325 div 8192 = 2 (2 × 8192 = 16384).
- Offset = 18325 − 16384 = 1941.
- From the page table, page 2 → frame 11.
- Physical address = 11 × 8192 + 1941 = 90112 + 1941 = 92053.
18325 = 010 0011110010101
| |
page 2 offset 1941
page table[2] = 11 = 1011
physical = 1011 0011110010101 = 92053
Answer: physical address = 92053.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Page fault; virtual to physical address · Operating System, chapter 4
- Logical and physical address bits · Operating System, chapter 4
- Segmentation; page table size; TLB · Operating System, chapter 4
- Page faults with 3 frames: LRU, FIFO, OPT · Operating System, chapter 4 · asked 2×
- Thrashing; page faults on 3 frames · Operating System, chapter 4
- Page size impact; internal, external fragmentation · Operating System, chapter 4
- Poisson: error pages in 400-page novel · Probability and Statistics, chapter 2
- Linear probing insertion into size-10 table · Data Structure and Algorithm, chapter 8
- File size: 10 s, 44.1 KHz, 16-bit stereo · Multimedia System, chapter 2 · asked 2×
- Physical vs logical clock; sync method · Distributed System, chapter 5 · asked 2×