Working Set Model
What you'll learn: You'll learn how the working set model defines which pages a process is actively using over a recent time window, helping the OS predict memory needs.
The Core Idea
The working set of a process is the collection of pages it has referenced during the last Δ time units (or last N memory accesses). This moving window captures the process's "active footprint" in memory.
Think of it like your desk at work: over the course of a day, you might pull out certain files repeatedly — your "working set" of documents. Files you haven't touched in hours aren't part of your current working set, even if they're still in your office.
Why Track Working Sets?
When you know a process's working set:
- You can predict how much memory it truly needs right now
- You can prevent thrashing — if the system can't hold the entire working set in physical memory, page faults skyrocket
- You can make smarter decisions about which processes to swap out or how many to multiplex
The Window Parameter Δ
The size of the time window (Δ) is crucial:
- Too small: The working set misses important pages the process will need soon
- Too large: The working set includes "cold" pages that won't be reused, wasting memory
The working set changes over time as the program moves through different execution phases (initialization → main loop → cleanup).
How It Helps Page Replacement
Unlike LRU or FIFO, which look backward at all history, the working set model says: "Keep exactly the pages used in the last Δ time, nothing more, nothing less." If a page falls outside the window, it's a candidate for replacement.
Key Takeaway: The working set model tracks a process's recently-used pages within a sliding time window, providing a dynamic view of its true memory needs and helping prevent thrashing.