Lecture 29: Virtual Memory-Address Translation

Slides:



Advertisements
Similar presentations
1 Lecture 13: Cache and Virtual Memroy Review Cache optimization approaches, cache miss classification, Adapted from UCB CS252 S01.
Advertisements

Operating Systems Lecture 10 Issues in Paging and Virtual Memory Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing.
OS Fall’02 Virtual Memory Operating Systems Fall 2002.
CS 333 Introduction to Operating Systems Class 12 - Virtual Memory (2) Jonathan Walpole Computer Science Portland State University.
Memory Management (II)
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management -3 CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Chapter 3.2 : Virtual 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.
Virtual Memory I Chapter 8.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
1 Tuesday, July 04, 2006 "Programs expand to fill the memory available to hold them." - Modified Parkinson’s Law.
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.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 346, Royden, Operating System Concepts Operating Systems Lecture 24 Paging.
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Computer Architecture Lecture 28 Fasih ur Rehman.
Lecture 19: Virtual Memory
Virtual Memory CS Introduction to Operating Systems.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 34 Paging Implementation.
IT253: Computer Organization
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-8 Memory Management (2) Department of Computer Science and Software.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Virtual Memory 1 1.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
Page Table Implementation. Readings r Silbershatz et al:
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Operating Systems Session 7: – Virtual Memory organization Operating Systems.
Silberschatz, Galvin and Gagne  Operating System Concepts Paging Logical address space of a process can be noncontiguous; process is allocated.
3/1/2002CSE Virtual Memory Virtual Memory CPU On-chip cache Off-chip cache DRAM memory Disk memory Note: Some of the material in this lecture are.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 33 Paging Read Ch. 9.4.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Virtual Memory Chapter 8.
CS161 – Design and Architecture of Computer
Memory: Page Table Structure
Basic Paging (1) logical address space of a process can be made noncontiguous; process is allocated physical memory whenever the latter is available. Divide.
Memory Hierarchy Ideal memory is fast, large, and inexpensive
Computer Organization
Virtual Memory So, how is this possible?
Memory Management Virtual Memory.
Section 8 Address Translation March 10th, 2017 Taught by Joshua Don.
Memory COMPUTER ARCHITECTURE
CS703 - Advanced Operating Systems
Page Table Implementation
Day 21 Virtual Memory.
Day 22 Virtual Memory.
CS510 Operating System Foundations
Paging and Segmentation
Lecture 28: Virtual Memory-Address Translation
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Computer Architecture
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Practical Session 9, Memory
Translation Buffers (TLB’s)
CSE451 Virtual Memory Paging Autumn 2002
Virtual Memory Prof. Eric Rotenberg
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Translation Buffers (TLB’s)
Computer Architecture
Translation Buffers (TLBs)
Review What are the advantages/disadvantages of pages versus segments?
4.3 Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

Lecture 29: Virtual Memory-Address Translation

Review:Address translation via Page Table

Review: Typical Page Table Entry Present/absent: 1 if the page is in memory Protection: what operations to the page are allowed Modified: 1 if the page is modified since it is loaded. Also called “dirty” bit Referenced: 1 if the page is read or written Caching disabled: 1 if disabling caching this page

Two problems of page table Speed Address translation is for every memory access Large page tables

Speeding up Address Translations Translation Lookaside Buffer = Page Table Cache Frequent page table entries in the high-speed cache – TLB hit Rest will go to slower-speed memory – TLB miss

TLBs – Translation Lookaside Buffers Speeds up paging by caching recent address translations Typically small size – a few 10s of entries TLB Hit rates are very important for performance

TLB is Associative Register Associative registers – parallel search Address translation (A´, A´´) If A´ is in associative register, get frame # out. Otherwise get frame # from page table in memory This is done by the OS, and takes some time Page # Frame #

Large page tables Multi-level page tables Inverted page tables

Page-Table Size Consider a full 232-byte address space assume 4096-byte (212-byte) pages 4 bytes per page table entry the page table would consist of 232/212 (= 220) entries its size would be 222 bytes (or 4 megabytes) Imagine 264-byte address space Before we get too excited about page tables, we need to determine what they cost and, in particular, how much memory is used merely to hold the page table. The picture computes the size of a page table for a 32-bit address space with 4K pages—4 megabytes. This is probably far too much memory to waste on a purely overhead function. What is needed is some technique for putting the page table itself into some form of virtual memory. Copyright © 2002 Thomas W. Doeppner. All rights reserved.

Multi Level Page Tables 1 1023 2 1 1023 2 10 10 12 1 1023 2 Level 1 2 level page table 32 bit address split as 10, 10, 12 Level 2

Multi Level Page Tables Address 1 1023 2 10 10 12 2 1020 1 1 1023 2 Level 1 Validity bit Level 2

Multi Level Page Tables 1 1023 2 Address 1 2 1020 Page fault! 2nd level page table not in memory. 1 Level 1 Validity bit Level 2

Multi Level Page Tables page fault! 1 1023 2 Address 1 1023 2 1 2 1020 1 1 Level 1 Fetch into memory Validity bit Level 2

Space Efficiency 1023 2 1 Level 1 Level 2 1 1023 2 1 1023 2 1 1023 2 Level 1 1 1023 2 Suppose only pages 0,1 and 1023 in the level 1 table were used Only those three 2nd level page tables need exist Level 2

One entry for each page of physical memory Inverted Page Tables One entry for each page of physical memory Virtual Address Page # Offset Page Frame Table Hash Table Here, inverted page tables, a variant of hashed page tables, are used to avoid wasting a large amount of memory for the translation map. A page frame table is maintained that indicates for each page frame of real memory what virtual address is mapped into it. In a typical implementation (we describe here a simplification of the IBM RS/6000 scheme), the hardware takes the page number from the virtual address, hashes this into a hash table, and then follows a linked list of hash synonyms in the page-frame table until it finds the desired entry. Then the index of this entry (in the page-frame table) is the page-frame number of the page. If the entry is not found, then a page fault is generated. This procedure would be quite slow if it were always performed exactly as described. However, it can be combined with the use of a TLB to achieve a system that, on the average, performs well. Another difficulty with inverted page tables is that there are usually portions of several address spaces in primary storage. Thus the virtual address of a page does not identify it uniquely, since different address spaces have pages with identical virtual addresses. So there must be some sort of address space ID to indicate which page is whose. There is a hardware register that contains the address space ID of the current address space, and each entry in the page-frame table contains an address space ID. Copyright © 2002 Thomas W. Doeppner. All rights reserved.

Page Size Usually 4KB or greater Too large – internal fragmentation Half of the last page is probably wasted Too small – number of pages increase Larger page table Greater overhead in transferring to/from disk