CSE 542: Operating Systems

Slides:



Advertisements
Similar presentations
CS 443 Advanced OS David R. Choffnes, Spring 2005 Practical, transparent operating system support for superpages Juan Navarro, Sitaram Iyer, Peter Druschel,
Advertisements

Chapter 10: Virtual Memory
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Chapter 9: Virtual Memory
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Virtual Memory Management G. Anuradha Ref:- Galvin.
Virtual Memory Operating System Concepts chapter 9 CS 355
Caching and Virtual Memory. Main Points Cache concept – Hardware vs. software caches When caches work and when they don’t – Spatial/temporal locality.
9.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory OSC: Chapter 9. Demand Paging Copy-on-Write Page Replacement.
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.
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.
03/26/2010CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying an earlier.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
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.
Chapter 10: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Chapter 10: Virtual Memory.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual Memory.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
Chapter 9: Virtual Memory. Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Caching and Virtual Memory. Main Points Cache concept – Hardware vs. software caches When caches work and when they don’t – Spatial/temporal locality.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples Operating.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Page Replacement Allocation of.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 9: Virtual-Memory Management.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
Chapter 9: Virtual-Memory Management. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 9: Virtual-Memory Management 9.1 Background.
1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples (not covered.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
3.1 Advanced Operating Systems Superpages TLB coverage is the amount of memory mapped by TLB. I.e. the amount of memory that can be accessed without TLB.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
Chapter 9: Virtual Memory
OPERATING SYSTEM CONCEPTS AND PRACTISE
Virtual Memory CSSE 332 Operating Systems
Chapter 9: Virtual Memory
Chapter 9: Virtual Memory – Part I
Chapter 9: Virtual Memory
Chapter 9: Virtual Memory
Chapter 9: Virtual Memory
Operating Systems Virtual Memory Alok Kumar Jagadev.
Module 9: Virtual Memory
Chapter 9: Virtual Memory
Virtual Memory.
Chapter 9: Virtual Memory
Chapter 9: Virtual-Memory Management
5: Virtual Memory Background Demand Paging
Chapter 9: Virtual Memory
Chapter 9: Virtual Memory
CSE 542: Operating Systems
Chapter 6 Virtual Memory
Contents Memory types & memory hierarchy Virtual memory (VM)
Chapter 9: Virtual Memory
Chapter 9: Virtual Memory
Lecture 9: Caching and Demand-Paged Virtual Memory
CSE 542: Operating Systems
Module 9: Virtual Memory
Chapter 9: Virtual Memory
Virtual Memory.
Chapter 8 & 9 Main Memory and Virtual Memory
CSE 542: Operating Systems
Presentation transcript:

CSE 542: Operating Systems Outline Chapter 10: Virtual Memory Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing The robustness of NUMA Memory Management Richard P. LaRowe Jr., Carla Schlatter Ellis and Laurence S. Kaplan 13th SOSP Practical, Transparent Operating System Support for Superpages Juan Navarro, Sitaram Iyer, Peter Druschel, and Alan Cox , In Fifth Symposium on Operating Systems Design and Implementation (OSDI 2002) 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems Virtual memory separation of user logical memory from physical memory Only part of the program needs to be in memory for execution Logical address space can therefore be much larger than physical address space Allows address spaces to be shared by several processes Allows for more efficient process creation Virtual memory can be implemented via: Demand paging Demand segmentation 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems Virtual Memory 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems Demand paging Lazy swapper Invalid pages generate page-fault trap OS checks to see if it is indeed illegal If valid, page it in Once disk IO completely, schedule the process and resume execution Performance implications 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems Process creation Copy-on-write Fork model duplicates process. OS shares the same copy and marks the pages invalid for write. Duplicate when any process tries to modify a page (trap to the OS) Memory mapped files: Virtual address space is logically associated with a file Page replacement: Memory reference string FIFO page replacement Belady’s anomaly 4-May-19 CSE 542: Operating Systems

Optimal page replacement Replace the page that will not be used for the longest period of time Approximations FIFO - Belady’s anamoly Least recently used (LRU) Counters: Update every page access Stack of page numbers used Additional reference bit algorithm Second chance algorithm Enhanced second-chance algorithm: Second chance+reference bit Least Frequently used Most Frequently used Global vs local replacement Thrashing 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems Page rates Paging rates affected by code (compiler) Locking memory for IO completion 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems NUMA Popular way to build scalable shared memory multi-processor Accesses to memory is not equal - page placement is important CPU Mem Interconnect 4-May-19 CSE 542: Operating Systems

OS vs application page placement Applications know best OS techniques can be leveraged by many applications How good are the tuneable page placement policies for a NUMA machine Too few migrations: pay remote access cost Too many migrations: pay page movement overhead Tradeoff local access for page movement Show that the policies are robust - a general setting applicable to a number of different scenarios 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems Superpages Increasing cost in TLB miss overhead growing working sets TLB size does not grow at same pace Processors now provide superpages one TLB entry can map a large region OSs have been slow to harness them no transparent superpage support for apps 4-May-19 CSE 542: Operating Systems

TLB coverage as percentage of main memory TLB coverage trend TLB coverage as percentage of main memory Factor of 1000 decrease in 15 years TLB miss overhead: 5% 5-10% 30% 4-May-19 CSE 542: Operating Systems

Why multiple superpage sizes Improvements with only one superpage size vs. all sizes 64KB 512KB 4MB All FFT 1% 0% 55% galgel 28% 29% mcf 24% 31% 22% 68% 4-May-19 CSE 542: Operating Systems

Issue 1: superpage allocation virtual memory D A B C superpage boundaries A B C D physical memory B How / when / what size to allocate? 4-May-19 CSE 542: Operating Systems

Promotion: create a superpage out of a set of smaller pages Issue 2: promotion Promotion: create a superpage out of a set of smaller pages mark page table entry of each base page When to promote? Create small superpage? May waste overhead. Wait for app to touch pages? May lose opportunity to increase TLB coverage. Forcibly populate pages? May cause internal fragmentation. 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems Issue 3: demotion Demotion: convert a superpage into smaller pages when page attributes of base pages of a superpage become non-uniform during partial pageouts 4-May-19 CSE 542: Operating Systems

CSE 542: Operating Systems Issue 4: fragmentation Memory becomes fragmented due to use of multiple page sizes persistence of file cache pages scattered wired (non-pageable) pages Contiguity: contended resource OS must use contiguity restoration techniques trade off impact of contiguity restoration against superpage benefits 4-May-19 CSE 542: Operating Systems