Operating Systems Unit 7: – Virtual Memory organization Operating Systems.

Slides:



Advertisements
Similar presentations
Multilevel Page Tables
Advertisements

Memory.
Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
OS Fall’02 Virtual Memory Operating Systems Fall 2002.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Chapter 10 – Virtual Memory Organization Outline 10.1 Introduction 10.2Virtual Memory: Basic Concepts 10.3Block Mapping 10.4Paging Paging Address.
Memory Management (II)
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management -3 CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Chapter 3.2 : Virtual Memory
9.9.2 Memory Placement Strategies Where to put incoming processes –First-fit strategy Process placed in first hole of sufficient size found Simple, low.
Chapter 3 Memory Management
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.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Computer Organization Cs 147 Prof. Lee Azita Keshmiri.
Virtual Memory I Chapter 8.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
Multilevel Page Tables Multilevel page tables –System can store in discontiguous locations in main memory those portions of process’s page table.
VIRTUAL MEMORY. Virtual memory technique is used to extents the size of physical memory When a program does not completely fit into the main memory, it.
CS 241 Section Week #12 (04/22/10).
Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.
CS333 Intro to Operating Systems Jonathan Walpole.
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Operating Systems Chapter 8
Computer Architecture Lecture 28 Fasih ur Rehman.
Lecture 19: Virtual Memory
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
Chapter 4 Memory Management Virtual Memory.
Memory Management Fundamentals Virtual Memory. Outline Introduction Motivation for virtual memory Paging – general concepts –Principle of locality, demand.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Virtual Memory 1 1.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Hardware.
Introduction to Virtual Memory and Memory Management
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
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.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
Memory Management Continued Questions answered in this lecture: What is paging? How can segmentation and paging be combined? How can one speed up address.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
Operating Systems Session 7: – Virtual Memory organization Operating Systems.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Operating Systems, Winter Semester 2011 Practical Session 9, Memory 1.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Memory: Page Table Structure
Memory Hierarchy Ideal memory is fast, large, and inexpensive
Computer Organization
Memory Management Virtual Memory.
Virtual Memory Chapter 7.4.
Memory COMPUTER ARCHITECTURE
CSE 120 Principles of Operating
CS703 - Advanced Operating Systems
Virtual Memory Chapter 8.
Paging and Segmentation
Chapter 8: Main Memory.
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Computer Architecture
Lecture 29: Virtual Memory-Address Translation
Lecture 3: Main Memory.
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CS703 - Advanced Operating Systems
4.3 Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

Operating Systems Unit 7: – Virtual Memory organization Operating Systems

COP Operating Systems2 Evolution of memory organization

COP Operating Systems3 Virtual Memory concept Solves problem of limited memory space –Creates illusion of more memory than exists Creates 2 types of addresses Virtual addresses –Referenced by processes Physical addresses –Describes locations in main memory Memory management unit (MMU) Dynamic address translation Translates virtual addresses to physical address

COP Operating Systems4 Two-level Storage backing store: –maintained on hard drive –contains complete virtual memory real memory: –portion of virtual memory that is currently in use Process can only access real memory –Management of mapping is essential

COP Operating Systems5 Two-level Storage

COP Operating Systems6 Address Translation Mapping virtual addresses to real addresses need address translation map per process Address translation maps –Indicate which regions of a process’s virtual address space are currently in main memory and where they are located

COP Operating Systems7 Mapping based on block

COP Operating Systems8 address translation map is table with –block number –actual location of block in memory typical implementation –block number is offset from table origin –table entries contain block location in memory Concept: block map table

COP Operating Systems9 structure of virtual address: b is the block number in virtual memory d is the displacement from the start of block b at which the referenced item is located Concept: virtual address

COP Operating Systems10 Block Mapping Process

COP Operating Systems11 Blocks ? Pages –Blocks are fixed size –Technique is called paging Segments –Blocks maybe of different size –Technique is called segmentation

COP Operating Systems12 Paging Paging uses fixed-size block mapping: –Virtual address in paging system: v = (p, d) p is the number of the page in virtual memory on which the referenced item resides d is the displacement from the start of page p at which the referenced item is located

COP Operating Systems13 Page Frame: page in real memory Fixed-size block of main memory Aligned with page size multiple

COP Operating Systems14 Page to Frame correspondence

COP Operating Systems15 Page Table Entry (PTE) maps virtual page p to page frame p´ –Contains bit to indicate if page is in real memory –Term: Page Fault access to memory location on page that is not in real memory

COP Operating Systems16 Page Address Translation Direct Mapping Associative Memory Translation Lookaside Buffer Concerns: –memory access speed –size of page table

COP Operating Systems17 Address Translation by Direct Mapping

COP Operating Systems18 Page Table size address size: 4 bytes bytes virtual memory amount: 4GB Page size: 4k pages in virtual memory PTE size: 8 bytes bytes maximum page table size: 8MB Page table will not fit into processor cache

COP Operating Systems19 Page Table size address size: 8 bytes bytes virtual memory amount Page size: 4k pages in virtual memory PTE size: 16 bytes bytes maximum page table size Page table will not fit into processor cache

COP Operating Systems20 Address Translation by Associative Mapping

COP Operating Systems21 Combination: Direct/Associative Mapping Experience shows: TLB size of 64 or 128 Can reach 90% of associative mapping performance

COP Operating Systems22 Page Address Translation: concerns memory access speed –consider cache speed size of page table –32 bit vs. 64 bit use of memory space –locality of memory references –sparseness advanced approaches –multi-level page tables –inverted page table

COP Operating Systems23 Multilevel Page Tables Hierarchy of page tables –Each level containing a table that stores pointers to tables in the level below –Bottom-most level comprised of tables containing address translations Can reduce memory overhead compared to direct-mapping system –page table does not have to be contiguous

COP Operating Systems24 Multilevel Page Tables

COP Operating Systems25 Inverted Page Tables –One inverted page table stores one PTE in memory for each page frame in the system –Inverted relative to traditional page tables –Uses hash functions to map virtual page to inverted page table entry

COP Operating Systems26 Inverted Page Tables

COP Operating Systems27 Inverted Page Tables Hash collisions increase memory accesses Collisions can be reduced by increasing the range of the hash function –Cannot increase the size of the inverted page table because it must store exactly one PTE for each page frame trick: hash anchor table – one more level of indirection

COP Operating Systems28 Inverted Page Tables with hash anchor table

COP Operating Systems29 Also: Page Sharing programs may share common pages –data and/or instructions pages marked as sharable or nonsharable

COP Operating Systems30 Segmentation based on variable-size segments –contiguous block of process’ address space data, text, stack process can run if current segment(s) is in main memory

COP Operating Systems31 Segmentation

COP Operating Systems32 Segmentation virtual memory address v = (s, d) –s is the segment number in virtual memory –d is the displacement within segment s at which the referenced item is located

COP Operating Systems33 Address Translation by Direct Mapping

COP Operating Systems34 Segment map table entry maps segment s to real memory address s´ –has resident bit to indicate segment is in memory If so, it stores the segment base address Otherwise, it stores the location of the segment on secondary storage –has segment length field useful to protect memory outside of segment

COP Operating Systems35 Segment map table entry

COP Operating Systems36 Segment map table entry: protection

COP Operating Systems37 Also: Segment Sharing Caution: segment protection

COP Operating Systems38 Combination: Segmentation/Paging Systems Segments occupy one or more pages All pages of segment need not be in main memory at once Pages contiguous in virtual memory need not be contiguous in main memory

COP Operating Systems39 –s is segment number –p is page number within segment –d is displacement within page at which desired item located Virtual memory address

COP Operating Systems40 Address Translation

COP Operating Systems41 System-wide Table Structure

COP Operating Systems42 Sharing and Protection Page replacement requires updates to several tables Protection checking is complex

COP Operating Systems43 Agenda for next week: next week: –Chapter 11: Virtual Memory Management –Read ahead !