Chapter 101 Virtual Memory Chapter 10 Sections 10.1 - 10.3.1 and 10.4 - 10.6 plus10.8.1 (Skip:10.3.2, 10.7, rest of 10.8)

Slides:



Advertisements
Similar presentations
Chapter 8 Virtual Memory
Advertisements

Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
1 Virtual Memory Management B.Ramamurthy. 2 Demand Paging Main memory LAS 0 LAS 1 LAS 2 (Physical Address Space -PAS) LAS - Logical Address.
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.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice.
Virtual Memory Chapter 8.
Virtual Memory Chapter 8.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Lecture 11: Memory Management
1 Virtual Memory Chapter 9. 2 Characteristics of Paging and Segmentation n Memory references are dynamically translated into physical addresses at run.
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.
Virtual Memory Chapter 8.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Lecture 9: Virtual Memory Operating System I Spring 2007.
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.
Virtual Memory (Chapter 8) Memory Management is an intimate and complex interrelationship between processor hardware and operating system software. Paging.
Virtual Memory Chapter 8.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
Chapter 8 Virtual Memory
1 Virtual Memory Management B.Ramamurthy Chapter 10.
Virtual Memory Management
Virtual Memory.
Virtual Memory Chapter 8. Characteristics of Paging and Segmentation A process may be broken up into pieces (pages or segments) that do not need to be.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Seventh Edition William Stallings.
1 Virtual Memory Chapter 8. 2 Virtual memory concept Simple paging/ segmentation  pages or segments are loaded into frames that may not necessarily be.
Virtual Memory. Background Virtual memory is a technique that allows execution of processes that may not be completely in the physical memory. Virtual.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 9: Virtual-Memory Management.
Memory Management. Why memory management? n Processes need to be loaded in memory to execute n Multiprogramming n The task of subdividing the user area.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
1 Virtual Memory. Cache memory: provides illusion of very high speed Virtual memory: provides illusion of very large size Main memory: reasonable cost,
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
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.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
Project 4 Awards First Place Group 7 Samuel Bartlett Michael Phillips Norman Chen.
Virtual Memory Chapter 8.
Computer Organization
Chapter 9: Virtual Memory – Part I
ITEC 202 Operating Systems
Day 20 Virtual Memory.
Chapter 8 Virtual Memory
Virtual Memory Chapter 8.
Lecture 10: Virtual Memory
Module 9: Virtual Memory
Chapter 9 Virtual Memory
Chapter 9: Virtual-Memory Management
5: Virtual Memory Background Demand Paging
Contents Memory types & memory hierarchy Virtual memory (VM)
Computer Architecture
Operating Systems Concepts
Module 9: Virtual Memory
Operating Systems: Internals and Design Principles, 6/E
CSE 542: Operating Systems
Presentation transcript:

Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)

Chapter 102 Observations on Paging and Segmentation  Memory references are dynamically translated into physical addresses at run time  A program may be broken up into small pieces (pages or segments) that do not need to be located contiguously in main memory  Provided that the portion of a program currently being executed is in memory, it is possible for execution to proceed, at least for a time.  So it is possible to execute a program that is not entirely loaded in memory. computation may proceed for some time if enough of the program is in main memory

Chapter 103 Locality of Reference and Memory Hierarchy CPU Memory Disk " A program spends 90% of its execution time in 10% of its code." Temporal Locality: Recently accessed items in memory are likely to be accessed again soon. Spatial Locality: Items with addresses that are close are likely to be accessed at about the same time. You could keep that critical 10% of the code in memory and the other 90% on disk, and most of the time the code the CPU needs would be in memory

Chapter 104 Locality and Virtual Memory  Memory references within a process tend to cluster.  So only a few pieces of a process are actually needed in memory at a particular time. the rest can be kept on disk  We just need to be able to deal with the case when the program tries to access a page that is not resident in memory.  Now, since only a portion of a process needs to be resident in memory at a time, it is no longer necessary for the entire process to fit in main memory.

Chapter 105 Program Execution with Virtual Memory  At process startup, the loader only brings into memory the page that contains the entry point  Each page table entry has a present bit that is set only if the corresponding piece is in main memory  A special interrupt (page fault) is generated if the processor references a memory page that is not in main memory  Whenever we reference a page not in memory, the OS responds to the page fault and brings in the missing page from disk  This is “demand paging”  We call that portion of the process’ address space that is in main memory the resident set

Chapter 106 New Format of Page Table Address Present Bit present bit: 1 if in main memory, 0 if not in main memory If page in main memory, this is a main memory address otherwise it is a secondary memory address

Chapter 107 Page Fault Handling  OS places the faulted process in a Blocked state  OS issues an I/O Read request to bring the needed page into main memory (another process can be dispatched to run while the read takes place)  an I/O interrupt is generated when the Read completes the OS updates the page table and places the faulted process in the ready state

Chapter 108 Handling a Page Fault

Chapter 109 Advantages of Partial Loading  More processes can be in execution Only load portions of each process With more processes in memory, it is less likely for them all to be blocked at once  A process can now execute even if its logical address space is much larger than the main memory size one of the most fundamental restrictions in programming is lifted.

Chapter 1010 Support for Virtual Memory  We need memory management hardware that must support paging and/or segmentation  And the OS must manage the movement of pages between secondary storage and main memory  We’ll look at the hardware issues first

Chapter 1011 Page Table Entries  Present bit already described.  Modified bit: Indicates if the page has been altered since it was last loaded If it has not been changed, it does not have to be written to secondary memory if it is swapped out  Other control bits: read-only/read-write bit protection level bit: kernel page or user page, etc. Typically, each process has its own page table

Chapter 1012 Paging With Translation Lookaside Buffer Frame

Chapter 1013 Support for Virtual Memory  The OS must manage the movement of pages between secondary storage and main memory  Need algorithms to decide how many frames to allocate per process,  to decide when to bring new pages in (Fetch Policy)  and to decide which frames to “bump” when we bring in new pages (Replacement Policy)

Chapter 1014 Page Fault Rate and Resident Set Size  Page Fault Rate depends on the number of frames (W) allocated for process  High if too few pages available  Page fault rate drops as W increases  Page fault rate is zero when working set holds entire process is in memory W = Resident Set N = Frames in process

Chapter 1015 Belady’s anomaly  For some page replacement algorithms, the page- fault rate may increase as the number of allocated frames increases.

Chapter 1016 Replacement Policy  When memory frames are occupied, and a new page must be brought in to satisfy a page fault: Which other page gets bumped to make room?  Not all pages in main memory can be selected for replacement  Some frames are locked (cannot be paged out): much of the kernel is held in locked frames as well as key control structures and I/O buffers

Chapter 1017 Optimal Page Replacement Algorithm  Replace page that will not be used for longest period of time.  Reference string:   6 page faults

Chapter 1018 Is it really optimal?  Results in the fewest page faults  No problem with Belady’s anomaly  But… Wickedly hard to implement (need to know the future)  Serves as a standard to compare with other algorithms:  Least Recently Used (LRU)  First-In, First-Out (FIFO)  LRU Approximations such as Clock (“Second Chance”)

Chapter 1019 The LRU Policy  Replaces the page that has not been referenced for the longest time in the past By the principle of locality, this would be the page least likely to be referenced in the near future   9 Page faults