A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Thrashing and the Working Set Model

College Depth 100 in the knowledge graph I know this Set as goal
365prerequisites beneath it
See this on the map →
Demand Paging and Page FaultsPage Replacement Algorithms
thrashing working-set locality frame-allocation multiprogramming-degree

Core Idea

Thrashing occurs when a system spends more time handling page faults than executing useful work — processes constantly page in and page out, and CPU utilization collapses. The cause is over-commitment: too many processes compete for too few frames. Denning's Working Set Model addresses this by tracking the set of pages a process has referenced in the last Δ time units (the working set), which captures its locality of reference. The OS should allocate each process at least its working set size worth of frames; if the sum of working sets exceeds available frames, the OS should reduce the degree of multiprogramming (suspend processes) rather than allow thrashing.

How It's Best Learned

Plot CPU utilization against degree of multiprogramming. Explain the knee of the curve where thrashing begins. Then compute working set sizes for a sample reference string at different window sizes.

Common Misconceptions

Explainer

From your study of page replacement algorithms, you know that when a process accesses a page not currently in physical memory, a page fault occurs: the OS must load the page from disk, evict another page if frames are full, and then resume the process. Page faults are expensive — disk access is thousands of times slower than memory access. Page replacement algorithms like LRU and FIFO try to minimize faults by making smart eviction choices. But there is a deeper problem that no replacement algorithm can solve on its own: what happens when there simply are not enough frames to go around?

Thrashing is what happens when the system crosses that line. Imagine ten students trying to share three textbooks, where each student needs at least two books at any given time. They spend all their time passing books around and none of it studying. That is thrashing: processes spend more time waiting for pages to be swapped in from disk than executing instructions. CPU utilization collapses — paradoxically, the system appears idle even though it is desperately busy servicing page faults. The OS, seeing low CPU utilization, may respond by admitting more processes (increasing the degree of multiprogramming), which makes thrashing worse by further dividing the already insufficient frames.

The key insight is locality of reference: at any given time, a process only actively uses a small subset of its pages. A word processor editing a document is not accessing its spell-check code, print-formatting routines, and file-import modules simultaneously. Denning's Working Set Model captures this by defining the working set as the set of pages a process has referenced within the last Δ time units (a sliding window over the reference string). If a process's working set contains 50 pages, it needs at least 50 frames to run without excessive page faults. The window parameter Δ must be tuned: too small and the working set misses pages the process will need momentarily; too large and it includes stale pages from a previous phase of execution.

The operating system's job is to sum up the working set sizes of all active processes and compare that total to the number of available physical frames. If the total exceeds capacity, thrashing is imminent. The correct response is counterintuitive: reduce the degree of multiprogramming by suspending one or more processes entirely (swapping them out to disk), freeing their frames for the remaining processes. Fewer processes each running efficiently produces more useful work than many processes all thrashing. This is the critical lesson — adding more work to an overloaded system does not just slow it down linearly; it can cause a catastrophic collapse in throughput where almost no useful computation occurs.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Assembly Language BasicsMemory Organization and AddressingMemory HierarchyCache Memory DesignCache Replacement PoliciesVirtual Memory and PagingVirtual Memory and Demand PagingPage Replacement AlgorithmsDemand Paging and Page FaultsThrashing and the Working Set Model

Longest path: 101 steps · 365 total prerequisite topics

Prerequisites (2)

Leads To (0)

No topics depend on this one yet.