---
title: "Page fault, demand paging, address translation"
subject: "Operating System"
chapter: 4
key: "semester_6/operating_system:page-fault-demand-paging-address"
source: https://www.bctengineer.com/q/semester_6/operating_system/page-fault-demand-paging-address
site: BCT Engineering
---

# Page fault, demand paging, address translation

Operating System · Chapter 4: Memory Management

- Asked in: 2072 Asoj, 3+6 marks
- Video: [Demand Paging and Page Fault ll Operating System ll Explained in Hindi](https://www.youtube.com/watch?v=ROVIH4m0LyU) — 5 Minutes Engineering
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/page-fault-demand-paging-address
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-4

## Question

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 |

## 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.

## Answer

#### 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**.

```text
 18325 = 010 0011110010101
          |       |
        page 2   offset 1941
        page table[2] = 11 = 1011
 physical = 1011 0011110010101 = 92053
```
**Answer: physical address = 92053.**

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is demand paging?
   A. Loading the whole program at start
   B. Preloading all pages
   C. Swapping entire processes
   D. Loading a page only when first referenced
   Answer: D. It is lazy swapping with a valid/invalid bit. (Key point: Demand paging)

2. For 18325 with 8 KB pages, page number?
   A. 2
   B. 1
   C. 3
   D. 18
   Answer: A. 18325 div 8192 = 2. (Key point: Page number)

3. Offset?
   A. 2133
   B. 18325
   C. 16384
   D. 1941
   Answer: D. 18325 - 16384 = 1941. (Key point: Offset)

4. Physical address?
   A. 92053
   B. 18325
   C. 90112
   D. 1941
   Answer: A. 11 * 8192 + 1941 = 92053. (Key point: Physical address)

## Related in Operating System

- [Page fault; virtual to physical address](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Apage-fault-64k-virtual-32k-physical) — Operating System, chapter 4
- [Logical and physical address bits](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Aresidence-monitor-address-bits) — Operating System, chapter 4
- [Segmentation; page table size; TLB](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Asegmentation-address-bits-tlb) — Operating System, chapter 4
- [Page faults with 3 frames: LRU, FIFO, OPT](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Apage-fault-circumstances-lru-fifo-optimal) — Operating System, chapter 4, asked 2×
- [Thrashing; page faults on 3 frames](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Athrashing-page-faults-fifo-opt-lru-lfu) — Operating System, chapter 4
- [Page size impact; internal, external fragmentation](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Apage-size-impact-fragmentation) — Operating System, chapter 4

## Related in other subjects

- [Poisson: error pages in 400-page novel](https://www.bctengineer.com/question.md?key=semester_5%2Fprobability_and_statistics%3Apublisher-typo-pages-400) — Probability and Statistics, chapter 2
- [Linear probing insertion into size-10 table](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Ahash-linear-probing-62-37) — Data Structure and Algorithm, chapter 8
- [File size: 10 s, 44.1 KHz, 16-bit stereo](https://www.bctengineer.com/question.md?key=semester_8%2Fmultimedia_system%3Aaudio-size-10s-44khz-16bit) — Multimedia System, chapter 2, asked 2×
- [Physical vs logical clock; sync method](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aphysical-clock-sync-difficulty) — Distributed System, chapter 5, asked 2×
