
The Working Set Model for Program Behavior Peter J. Denning Massachuse=s Ins?tute of Technology, Cambridge, Massachuse=s 1 About the paper • Published in 1968, 1st ACM Symposium on Operaon Systems Principles (SOSP) • 2005, SIGOPS Hall of Fame Award “This paper introduced the working set model, which has became a key concept in understanding of locality of memory references and for implemen:ng virtual memory. Most paging algorithms can trace their roots back to this work” 2 Background: Virtual memory • In the 50s ~ 60s – System: ATLAS computer – Two-level memory hierarchies: main memory + auxiliary storage – Demand paging – Backbone for mul?programming 3 Background: Thrashing “When it was first observed in the 1960s, thrashing was an unexpected, sudden drop in throughput of a mul:programmed system … I explained the phenomenon in 1968 and showed that a working-set memory controller would stabilize the system ...” – Peter D. Denning 4 Mo?vaon • Develop a unified approach to tackle the resource allocaon problem: process scheduling and memory management • However, such unified approach is absent, because there is no adequate model for program behavior – Program behavior: a program’s system demand, including processor and memory demand 5 Working Set Model - Overview • Intended to model the behavior of programs, specifically the programs’ memory demand • What is the working set of a program? – Programmer’s standpoint: the smallest collec?on of informaon must be present in main memory to assure efficient execu?on of the program – System’s standpoint: the set of most recently referenced pages 6 Working Set Model - Defini?on • Working set informaon of a process at ?me t is defined as collec?on of memory pages referenced by the process during the ?me interval (t - τ, t), τ is the working set parameter 7 Working Set Model - Example sequences of page references 2 6 1 5 7 7 7 7 7 5 1 6 2 3 4 1 2 3 4 4 4 W(t1, τ) = {2, 6, 1, 5, 7} 2 6 1 5 7 7 7 7 7 5 1 6 2 3 4 1 2 3 4 4 4 W(t2, τ) = {7, 5, 1} 2 6 1 5 7 7 7 7 7 5 1 6 2 3 4 1 2 3 4 4 4 W(t3, τ) = {4, 1, 2, 3} 8 Working Set Model - Proper?es • P1. Size of working set – w(t, τ): number of pages in working set W(t, τ) – w(t, 0) is 0 – w(t, τ) is a monotonically increasing func?on of τ 9 Working Set Model - Proper?es • P2. Predicon – For small me separaon α, the set W(t, τ) is a good predictor for the set W(t + α, τ), because references to the same page tend to cluster in ?me, the probability (below) is small – On the other hand, for large &me separaon α (say, α >> τ), W(t, τ) is a not good predictor for the set W(t + α, τ) 10 Working Set Model - Proper?es • P3. Reentry Rate – The rate at which memory page reenters a working set – Important property for analyzing page traffic – Highly related to the value of τ. • E.g. as τ is reduced, size of working set decreases, the probability that needed pages are not in W(t, τ) increases. 11 Working Set Model - Proper?es • P3. Reentry Rate (con?nued) – Process-me reentry rate λ(τ) = 1/m(τ), where m(τ) is the mean ?me between reentries – Real-&me reentry rate ϕ(τ) = λ(τ) / (1 + λ(τ)T ), where T is the traverse ?me for fetching a page – Total return traffic rate βMϕ(τ) • βM is the average number of pages for all working sets • It es?mates the number of pages per unit ?me returning to main memory 12 Working Set Model - Proper?es • P4. τ – Sensi?vity – Measures how sensi?ve is the reentry rate λ(τ) to changes in τ if τ is decreased by dτ, λ(τ) increases by dτ σ(τ) 13 Choice of τ • If τ is “too small”, it may result in high traffic of returning pages • If τ is “too large”, it may result in wasted main memory • Recommended τ: a value comparable to the memory traverse ?me T 14 Detec?ng W(t, τ) • A hardware-based approach is described, but not prac?cal • Need a sosware-based approach • The paper proposes sampling the page table entries at intervals of σ seconds, where σ = τ / K (K an integer constant) “The idea of sampling for used pages was not new …… What was new was that the window was defined in the virtual :me of the program …” 15 Detec?ng W(t, τ) • Page table entries for detec?ng W(t, τ) - M is 1 if and only if page is in main memory - 1->u0 each ?me a page reference occurs - At end of each sampling interval, paern in use bits shised right one posion 16 Memory Allocaon • A program will not be run unless there is space in memory for its working set • Knowledge of working set size w(t, τ) with demand paging suffices to mange memory well • Before running a process, insure that there are enough pages of memory to contain its working set 17 Scheduling Implementaon with Working Set • Required proper?es – Memory management and process scheduling be closely related ac?vi?es – Sampling of page tables, only on changing working sets, and as infrequently as possible – Provide measurements of current working set sizes and processor me consumpon for each process 18 19 Resource Allocaon: A Balancing Problem • Formulate the resource allocaon as a problem of balancing processor and memory demands against available resources • “memory demand” of process I where M is number of pages of main memory 20 Resource Allocaon: A Balancing Problem • But how to define the “processor demand” • Idea: define “processor demand” to be the frac?on of a standard interval a process is expected to use before it blocks – Standard interval A, chosen to reflect the maximum tolerable response ?me to a user – Condi?onal expectaon func?on Q(ti), to predict the amount of process ?me to elapse before the next interac?on 21 Resource Allocaon: A Balancing Problem • “processor demand” of process i Where N is the number of processors • “system demand” is defined as Di = (pi, mi) 22 Resource Allocaon: A Balancing Problem • Then, a system is balanced if S is dynamically maintained, and measures the total demand of current running list α, β are constants chose to achieve desired frac?on of resource to cons?tute balance • To keep the computer system in balance, a “balance policy” can be designed to minimize ( S – (α, β ) ) 23 Conclusion • Define the working set model for program behavior • Working set model provides an convenient way to determine what informaon is in use by a computaon and which is not • Working set model enables simple determinaon of memory demands 24 .
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages24 Page
-
File Size-