Ch. 21 · Operating Systems

Operating-System Page Cache and I/O Measurements

Operating-System Page Cache and I/O Measurements. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readadvancedupdated Oct 3, 2026

The page cache retains file data in memory and changes observed I/O behavior. Warm and cold reads can have very different costs.

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: A second file read may avoid physical storage because pages remain cached. 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 cache state

Repeated reads may reuse resident file data.

Step 2: Match working-set size

A tiny dataset can fit in memory while production cannot.

Step 3: Report benchmark conditions

Separate memory reuse from actual storage work.

Worked scenario

A second file read may avoid physical storage because pages remain cached.

The first scan reads storage, while the second completes much faster from cached pages. Reporting only the second result overstates performance for cold or larger-than-memory workloads. Warm-cache performance is still meaningful if it matches the target application; state which condition the measurement represents.

Common mistake

A warm benchmark can overstate performance for a workload with a much larger working set.

Verify the behavior

Compare representative warm and cold behavior without confusing the two results.

Interview exercise

Design an honest benchmark.

Answer and reasoning

Describe cache state and working-set size, measure representative runs and separate storage work from memory reuse.

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