= Working set
{title2=$W(t,\Delta)$}
{wiki}
An <operating-system process>'s <working set> is the <set> of distinct <memory pages> used in a declared recent window. Here the window counts <memory references>, not clock time: let $r_i$ identify the <memory page> accessed by the $i$th <memory reference>, and let the positive <integer> $\Delta$ be the window length. Immediately after reference $t$,
$$
W(t,\Delta)=\{r_i:\max(1,t-\Delta+1)\leq i\leq t\},\qquad W(0,\Delta)=\varnothing.
$$
Repeated <memory references> to the same <memory page> contribute only one <set element>. The <working set size> is the <cardinality> $|W(t,\Delta)|$. This recent footprint estimates current demand; it cannot guarantee which <memory pages> future <memory references> will need. The <resident set> instead records which <memory pages> are actually present in <computer memory>.
For the 20-reference <sequence> in <memory thrashing> and $\Delta=4$, the successive <working sets> begin $\{1\}$, $\{1,2\}$, $\{1,2,3\}$ and $\{1,2,3,4\}$. At $t=5$, the window is references 2–5, namely $2,3,4,1$, so $W(5,4)=\{1,2,3,4\}$ again. Every later four-reference window contains all four <memory pages>. Under three-<page frame> <LRU replacement>, however, the <resident set> at $t=5$ is $\{1,3,4\}$: page 2 was evicted. Consequently the <working set size> is four even though only three <memory pages> are resident. Under four-<page frame> <LRU replacement>, the <resident set> contains the complete <working set> after reference 4.
\Image[/working-set-reference-window.png]
{title=A four-reference <working set> remains four pages while a three-frame <resident set> contains only three}
Window choice matters: on this same <sequence>, $\Delta=2$ reports only two distinct <memory pages> after reference 2, despite the recurring four-page cycle. A short window forgets useful <memory pages> sooner; a long window retains evidence from older phases. Enlarging the window can only enlarge or preserve the <working set> at fixed $t$, because the shorter window is contained in the longer one. No single window is best for every workload.
For a concrete <multiprogramming> budget, suppose three <operating-system processes> each have a four-page <working set>, no shared <page frames>, and only eight <page frames> are available for their data. Their combined demand is 12 <page frames>; all three <working sets> cannot be resident together. Letting two <operating-system processes> run while the third waits makes their eight-page demand fit in this simplified model. Real budgets also reserve <computer memory> for the <operating system> and other uses; shared <memory pages> must not be counted repeatedly as different physical copies.
Peter J. Denning's https://denninginstitute.com/pjd/PUBS/WSModel_1968.pdf[The Working Set Model for Program Behavior, Communications of the ACM, May 1968, sections 3–4]{ref} formalized the <working set> using recent process execution time, rather than this article's reference count. Its central insight connected memory demand to <process scheduling>: deciding which <operating-system processes> run also decides which <working sets> need room. <Temporal locality> makes recent use informative, without making it a promise about the future. The beautiful distinction is between a large possible <address space> and the smaller footprint of the current activity.
Back to article page