High Performance Computing and Software Lab, W&M ALS '01, 11/10/2001 1 Adaptive Page Replacement to Protect Thrashing in Linux Song Jiang, Xiaodong Zhang.

Slides:



Advertisements
Similar presentations
Page Replacement Algorithms
Advertisements

Chapter 11 – Virtual Memory Management
Chapter 3 Memory Management
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Virtual Memory: Page Replacement
Paging: Design Issues. Readings r Silbershatz et al: ,
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Energy Efficiency through Burstiness Athanasios E. Papathanasiou and Michael L. Scott University of Rochester, Computer Science Department Rochester, NY.
Allocation of Frames Each process needs minimum number of pages
Operating Systems Prof. Navneet Goyal Department of Computer Science & Information Systems BITS, Pilani.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
Module 9: Virtual Memory
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
Virtual Memory Background Demand Paging Performance of Demand Paging
Virtual Memory Introduction to Operating Systems: Module 9.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Virtual Memory.
ECE 7995 Caching And Prefetching Techniques In Computer System Professor: Dr. Song Jiang.
Operating System Support Focus on Architecture
Improving Proxy Cache Performance: Analysis of Three Replacement Policies Dilley, J.; Arlitt, M. A journal paper of IEEE Internet Computing, Volume: 3.
1 Virtual Memory vs. Physical Memory So far, all of a job’s virtual address space must be in physical memory However, many parts of programs are never.
Understanding Operating Systems1 Operating Systems Virtual Memory Thrashing Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions.
Memory Management 2010.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Chapter 9: Virtual Memory Background.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
Computer Organization and Architecture
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual Memory.
OS Spring’04 Virtual Memory: Page Replacement Operating Systems Spring 2004.
CSCI2413 Lecture 6 Operating Systems Memory Management 2 phones off (please)
1 Token-ordered LRU an Effective Policy to Alleviate Thrashing Presented by Xuechen Zhang, Pei Yan ECE7995 Presentation.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Operating Systems ECE344 Ding Yuan Page Replacement Lecture 9: Page Replacement.
Virtual Memory.
Chapter 3 Memory Management: Virtual Memory
Naixue GSU Slide 1 ICVCI’09 Oct. 22, 2009 A Multi-Cloud Computing Scheme for Sharing Computing Resources to Satisfy Local Cloud User Requirements.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Page 19/17/2015 CSE 30341: Operating Systems Principles Optimal Algorithm  Replace page that will not be used for longest period of time  Used for measuring.
CS 241 Fall 2007 System Programming 1 Virtual Memory Lawrence Angrave and Vikram Adve.
Memory Thrashing Protection in Multi-Programming Environment Xiaodong Zhang Ohio State University College of William and Mary In collaborations with Song.
Second-Chance Algorithm Basically, it’s a FIFO algorithm When a page has been selected, we inspect its reference bit. If the value is 0, we proceed to.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Copyright ©: Lawrence Angrave, Vikram Adve, Caccamo 1 Virtual Memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Page Replacement Allocation of.
Computer Systems Week 14: Memory Management Amanda Oddie.
Memory Thrashing Protection in Multi-Programming Environment Xiaodong Zhang Ohio State University In collaborations with Song Jiang (Wayne State University)
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Demand Paging Reference Reference on UNIX memory management
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
NETW3005 Virtual Memory. Reading For this lecture, you should have read Chapter 9 (Sections 1-7). NETW3005 (Operating Systems) Lecture 08 - Virtual Memory2.
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
1 Page Replacement Algorithms. 2 Virtual Memory Management Fundamental issues : A Recap Key concept: Demand paging  Load pages into memory only when.
Operating Systems ECE344 Ding Yuan Page Replacement Lecture 9: Page Replacement.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Memory Thrashing Protection in Multi-Programming Environment
Lecture 12 Virtual Memory.
ITEC 202 Operating Systems
Memory Thrashing Protection in Multi-Programming Environment
Virtual Memory Chapter 8.
Module 9: Virtual Memory
Chapter 9: Virtual-Memory Management
Page Replacement.
5: Virtual Memory Background Demand Paging
Module 9: Virtual Memory
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Chapter 9: Virtual Memory CSS503 Systems Programming
CSE 542: Operating Systems
Presentation transcript:

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Adaptive Page Replacement to Protect Thrashing in Linux Song Jiang, Xiaodong Zhang College of William and Mary

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ What Thrashing in Linux We Target? F Multiprogramming environment F Memory shortage spread F Each process has lots of page faults F Very low CPU utilization

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Existing Schemes and Our Approach We address the problem by adjusting page replacement. F Local replacement; F Kill some processes (e.g. Linux); F Load control (e.g. BSD);

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Outline F How thrashing develops in the kernel? F Analysis of page replacement variations in Linux; F How our Thrashing Protection Facility (TPF) works? F Performance evaluation F Conclusion

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ How thrashing develops in the kernel? Proc1 Proc2 CPU Memory demand paging IDLE Physical memory

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Factors Related to Thrashing FThe size of memory space in the system; FThe number of processes; FThe dynamic memory demands; FThe page replacement scheme.

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Outline F How thrashing develops in the kernel? F Analysis of page replacement variations in Linux; F How our Thrashing Protection Facility (TPF) works? F Performance evaluation F Conclusion

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Framework of Linux Page Replacement An NRU (Not Recently Used) page searching starts from where it was done last time. (1) Select a swappable process to find NRU pages; (2) Check through the virtual memory pages in the selected process; if not find NRU pages, go to (1) for next process. é in a process by process, and page by page fashion

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Two Aspects Related to Thrashing FHow many NRU pages in a selected process are allowed to replace continuously? FHow easily NRU pages can be generated? Allow a large amount of pages to be replaced from a specific process once a time Prepare enough NRU pages for eviction Memory shortage concentrate on one or a few specific processes Help others to build up their working set, and reduce thrashing possibility

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ FNRU page contributions are distributed; FNRU pages are generated by aging. ê Encourages spreading the memory shortage burden over processes, so that no one can build up its working set. Replacement in Kernel 2.0

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Kernel 2.0 Ready to go to next proc Try to find an NRU page in p NRU page found? Ready to go to next proc --count>0? succeed fail Let p be current swappable process p->swap_cnt==0? p->swap_cnt = RSS/MB p->swap_cnt -- p->swap_cnt==0? Y Y N N Y N Y N

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ F A selected process continuously contribute its NRU pages; FNo page aging any more. ê Penalize the memory usage of one process at a time. Thus others have more chances to build up their working sets. Replacement in Kernel 2.2

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Kernel 2.2 Try to find an NRU page in pbest NRU page found? --count>0? succeed fail For each process p: p->swap_cnt = p->RSS Y Find the process pbest with maximum p->swap_cnt pbest->swap_cnt = 0 For all process P p->swap_cnt = 0 ? N N Y Y N

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Replacement in Kernel 2.4 Addressing concerns on memory performance of Kernel 2.2 by re-introducing: F proportional NRU page distribution; F page aging.

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Kernel count>0? done Let P be the next process N Y Walk about 6% of the address space of p

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Summary of the Replacement Behavior during Thrashing

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Why an adaptive policy is needed for thrashing protection? Conflicting interests in the design: u Regarding CPU utilization, keep at least one process active u Regarding memory utilization, apply the LRU principle consistently to all the processes.

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ The Goal of Our Adaptive Solution F When CPU utilization is not a concern, make memory resource be efficiently used. F When CPU utilization is low due to thrashing, change replacement behavior adaptively.

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Outline F How thrashing develops in the kernel? F Analysis of page replacement variations in Linux; F How our Thrashing Protection Facility (TPF) works? F Performance evaluation F Conclusion

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Basic Idea of Thrashing Protection Facility (TPF) Multiple “CPU cycle eager” processes but with high page fault rates Low CPU utilization Temporal tuning on page replacement to help specific process build up its working set CPU utilization increased Return to normal page replacement

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Parameters of TPF §CPU_Low: the lowest CPU utilization the system can tolerate. §CPU_High: the targeted CPU utilization for TPF to achieve. §PF_High: the page fault rate threshold for a process to potentially cause thrashing. §PF_Low: the targeted page fault rate of the identified process for TPF to achieve. In addition, the list “ high_PF_proc ” records processes with high page fault rates

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ TPF state transition Monitoring State Normal State Protection State Length(high_PF_proc)>1 Length(high_PF_proc)<=1 and CPUutilization<CPU_Low and length(high_pf_proc)>=2 Page fault rate of or protected proc<PF_Low or CPU utilization>CPU_High

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Outline F How thrashing develops in the kernel? F Analysis of page replacement variations in Linux; F How our Thrashing Protection Facility (TPF) works? F Performance evaluation F Conclusion

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Characterizations of Workloads

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Experiment settings §Pentium II of 400 MHz §Red Hat Linux release 6.1 with Kernel §The predetermined threshold values are set as follows: CPU_Low = 40%, CPU_High = 80%, PF_High = 10 faults/second, PF_Low = 1 fault/second. We instrumented the kernel to adjust the available user memory so that different memory constraints can be formed to facilitate our experiments.

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ X axis: execution time Y axis: number of pages Time-space figures of dedicated execution MAD: the number of pages requested RSS: the number of resident pages bit-r LU

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ gcc vortex Time-space figures of dedicated execution

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Comparison for gcc+vortex (42% memory shortage) Without TPF With TPF

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Comparison for gcc+bit-r (31% memory shortage) Without TPF With TPF

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Comparison for LU1+LU2 (35% memory shortage) Without TPF With TPF

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Comparison of Execution Time vortex gcc vortex gcc bit-t LU1 LU2 LU1 LU2

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Comparisons of Numbers of Page Faults vortex gcc vortex gcc bit-t LU1 LU2 LU1 LU2

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Comparison of Total Execution Time

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Conclusion FThrashing can be easily triggered by: (1) Dynamical memory usage, (2) Common memory reference patterns, and (3) Serious memory shortage. FTPF is highly responsive to stop thrashing triggered by (1) and (2); F TPF has little intervention to multiprogramming environment; FLoad control will be used only when it is truly necessary.

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Experiences with TPF in the Multiprogramming F Under what conditions, does thrashing happen in a multiprogramming environment? FFor what cases is TPF most effective? FFor what cases is TPF ineffective? FHow do the threshold parameters affect the performance of TPF?

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ An Example: How could thrashing in Linux effect performance? gcc vortex (Linux Kernel )

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ FMemory shortage 42%. FThe time of first spike of gcc is extended by 65 times, Fthe time of a stair of vortex is extended by 14 times

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Conclusion Contribution: HIdentify the difficulty in the page replacement design; HPropose the adaptive replacement solution; HImplement TPF and show its effectiveness.

High Performance Computing and Software Lab, W&M ALS '01, 11/10/ Three States in TPF ※ Normal state : Keep track of the page fault rate for each process and place the processes with rates higher than ``PF_High'' into list ``high_PF_proc". ※ Monitoring state : Monitor the CPU utilization and the page fault rates of processes in the list ``high_PF_proc". Select the “least memory hungry” process in the ``high_PF_proc” for protection when CPU utilization is low. ※ Protection state : Mark the selected process and let its ``swap_cnt'' reset to 0 no matter whether a replaced page has been successfully found (in Kernel 2.2). This lets the process contribute at most one page continuously and help it quickly establish its working set.