4.1.17 · D1Computer Architecture (Deep)

Foundations — Working set model, thrashing

1,800 words8 min readBack to topic

This is the ground-floor page for the Working Set & Thrashing topic. We assume you have never seen any of this notation. We define each symbol in plain words, draw the picture it stands for, and say why the topic needs it — in an order where each idea rests on the one before.


0. The stage: memory is split into equal-sized boxes

Before any symbol, picture the two places your program's data can live.

Figure — Working set model, thrashing
  • RAM (physical memory) — the fast desk right in front of you. Small.
  • Disk (the swap area) — the slow shelf across the room. Huge.

Both are chopped into equal-sized chunks so the operating system can shuffle them cheaply.

Why the topic needs this: the whole working-set model is a story about which pages sit in which frames. Without the page/frame split there is no "should this stay in RAM?" question to answer. This connects directly to Demand Paging.


1. A "memory reference": the atom of everything

Every symbol later counts these, so we define it first.

Picture a program executing:

load  X     -> touches the page holding X
add   Y     -> touches the page holding Y
store X     -> touches the page holding X again

Each arrow above is one reference. A reference is not a second, not a byte — it is one access event.

Why the topic needs it: the working-set window is measured in these events, not in clock time. Getting this straight now prevents the classic " is in seconds" mistake later.


2. Virtual time : counting by references, not by clock

Figure — Working set model, thrashing

The symbol everywhere in the parent note ("ending at virtual time ") is just: how many references have happened so far.


3. The reference string: the program written as a list of pages

Each number is which page that reference hit. The position in the list is the virtual time: the "" in the fifth slot happened at .

Why the topic needs it: this list is the raw input to every calculation in the parent note — computing , tracing faults, spotting locality. It is the program viewed purely through the lens of "what did it touch, and when?"


4. The window : how far back we look

Now the first Greek symbol. is spelled "delta" and here it is just a whole number.

Figure — Working set model, thrashing

Picture as a sliding window of fixed width gliding along the reference string. It always covers exactly entries (once we're past the start), and it moves right by one every time a new reference happens.


5. The set and its size

Two pieces of notation arrive together: the curly-brace set and the vertical-bar size.

Put together:

Worked micro-trace. Reference string , take .

At : the window holds pages → all distinct → , so . At : the window holds → distinct pages are .

Why the topic needs it: is the process's frame demand. Every allocation decision downstream is built on this single number.


6. Frames available , total demand , and the sum

Last symbols before the punchline.

Now the parent note's headline formula reads in plain English:

See Multiprogramming Degree for how many processes we dare run at once, and Page Fault Handling for what happens on each miss.


7. How the foundations feed the topic

Memory reference (one access event)

Virtual time t (count of references)

Reference string (list of pages)

Page and Frame (block vs slot)

Window size delta

Working set W(t,delta) using set braces

Working set size mod W (frames needed)

Total demand D = sum of mod W

Frames available m

Thrashing condition D greater than m

Locality of reference

Working Set Model and Thrashing

Read it top-down: an access event defines virtual time and the reference string; page/frame gives the vocabulary of what moves; the window slides over the string to build the set ; the set's size is the frame demand; summing demands gives ; comparing to is the whole topic.


Equipment checklist