Ch. 21 · Operating Systems

Paging, Page Faults and Memory Access

Paging, Page Faults and Memory Access. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readbeginnerupdated Oct 3, 2026

A page fault indicates that a memory access needs handling beyond the current mapping. Its cost depends on whether data is already resident or needs I/O.

Before you start

You should understand processes, threads, memory and basic file operations. Track ownership and state changes over time. For concurrent scenarios, write down at least two possible execution orders; the same instructions can behave differently when scheduling or resource availability changes.

The practical goal is to reason through this situation: First access to a valid demand-allocated page can trigger normal allocation work. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Identify the fault cause

An access can need a mapping, allocation or unavailable data.

Step 2: Separate valid and invalid access

A demand-allocation fault can be normal; protection failure has different meaning.

Step 3: Measure residency and I/O

Not every handled fault requires disk access.

Worked scenario

First access to a valid demand-allocated page can trigger normal allocation work.

A process touches a newly allocated page for the first time, causing normal demand allocation. Later it accesses a valid page evicted to storage, potentially requiring costly I/O. An invalid pointer can instead trigger an access violation. Calling all three ‘page faults’ does not establish the same performance or correctness issue.

Common mistake

Every page fault is not automatically a programming error or disk read.

Verify the behavior

Correlate fault types, storage activity and access patterns in the observed environment.

Interview exercise

Diagnose slow memory access.

Answer and reasoning

Examine fault type, residency and I/O pressure alongside access patterns and total working-set size.

Continue learning

Compare the scenario with the Operating Systems interview questions and test your understanding with the Operating Systems MCQs. For terminology and implementation details, consult the reference material.

More in Operating Systems

read ✓Operating Systems · hard

Operating Systems: CPU Cache Locality

Improve performance with spatial and temporal locality, avoid pointer chasing, and understand false sharing between threads.

~2 min readread →
read ✓Operating Systems · hard

Copy-on-Write Memory and fork

How copy-on-write lets fork share pages until a write, why RSS can be misleading, and the implications for memory and latency.

~2 min readread →
read ✓Operating Systems · hard

Operating Systems: epoll and select

How select, poll and epoll report I/O readiness, and the difference between level- and edge-triggered notifications.

~2 min readread →
esc