Project 4: Page Fault Analyzer

A tool that monitors page faults in running programs, distinguishing major from minor faults, showing which virtual addresses faulted, and mapping faults to source code locations.

Quick Reference

Attribute Value
Primary Language See main guide
Alternative Languages N/A
Difficulty Level 4: Expert
Time Estimate 2-3 weeks
Knowledge Area Virtual Memory / Kernel Tracing
Tooling perf_event_open
Prerequisites C, understanding of virtual memory basics

What You Will Build

A tool that monitors page faults in running programs, distinguishing major from minor faults, showing which virtual addresses faulted, and mapping faults to source code locations.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Using perf_event_open() to capture page faults (maps to kernel tracing interfaces)
  • Distinguishing major vs minor faults (maps to page fault types, I/O)
  • Correlating fault addresses with memory regions from /proc/pid/maps (maps to virtual memory layout)
  • Understanding COW and lazy allocation (maps to memory optimization strategies)
  • Symbolizing addresses to function names (maps to debugging/profiling)

Key Concepts

  • Page fault handling: “Operating Systems: Three Easy Pieces” Ch. 21 - Arpaci-Dusseau
  • Memory mapping: “The Linux Programming Interface” Ch. 49 - Michael Kerrisk
  • perf_event_open: man page + kernel documentation
  • /proc/pid/maps format: “The Linux Programming Interface” Ch. 48 - Michael Kerrisk

Real-World Outcome

Deliver a working demo with observable output that proves the feature is correct.


Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: TRACK_A_OS_KERNEL_PROJECTS.md
  • “Operating Systems: Three Easy Pieces” by Arpaci-Dusseau