- 2069 Bhadra · 2+8 marks
Page fault; virtual to physical address
Short answer
A page fault occurs when a referenced page is not in main memory. For virtual address 20482 with 4KB pages, page number is 5, offset 2; given page table maps page 5 to frame 3, so physical address is 12290 (no fault).
What is page fault? Assume that a virtual memory of size 64K is mapped to physical memory of 32K with page frame 4K. Initially, pages are mapped as: 0,1,2,3,4,5,9,11 correspond to 2,1,6,0,4,3,5,7 respectively. Calculate outgoing physical address for incoming virtual address 20482 with necessary mapping diagrams.
Page fault
A page fault is a trap raised by the MMU when a process references a page that is in its virtual address space but whose page-table entry is marked not present in main memory. The OS then finds the page on disk, loads it into a free frame (replacing a page if none is free), updates the page table and restarts the instruction.
Address translation
- Page size = frame size = 4 KB = 4096 bytes.
- Virtual pages = 64K / 4K = 16 (pages 0 to 15, 4-bit page number); physical frames = 32K / 4K = 8 (frames 0 to 7, 3-bit frame number). Offset = 12 bits.
- Virtual address = 20482. Page number = 20482 div 4096 = 5 (5 × 4096 = 20480). Offset = 20482 − 20480 = 2.
Page table (given mappings; others not present):
page : 0 1 2 3 4 5 9 11
frame: 2 1 6 0 4 3 5 7
Page 5 maps to frame 3 (present, so no page fault).
Virtual address 20482 = 0101 000000000010
| |
page 5 offset 2
v
page table[5] = frame 3 (011)
v
Physical address = 011 000000000010
= 3 x 4096 + 2 = 12290
Answer: physical address = 12290 (frame 3, offset 2; hexadecimal 0x3002).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Page fault, demand paging, address translation · Operating System, chapter 4
- Logical and physical address bits · Operating System, chapter 4
- Segmentation; page table size; TLB · Operating System, chapter 4
- Page size impact; internal, external fragmentation · Operating System, chapter 4
- File system vs virtual memory; contiguous allocation · Operating System, chapter 5
- Virtual memory management; thrashing · Operating System, chapter 4
- Memory-mapped I/O reduces address space · Computer Organization and Architecture, chapter 7
- Poisson: error pages in 400-page novel · Probability and Statistics, chapter 2
- Unique/non-unique decoding, memory mapped I/O · Microprocessor, chapter 4
- Memory-mapped I/O design for 8085 · Instrumentation II, chapter 2