Lecture 13: Virtual Memory Management. CSC 469H1F Fall 2006 Angela Demke Brown

Similar documents
Address Translation. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CS 153 Design of Operating Systems Winter 2016

VIRTUAL MEMORY II. Jo, Heeseung

Memory Management. An expensive way to run multiple processes: Swapping. CPSC 410/611 : Operating Systems. Memory Management: Paging / Segmentation 1

CS162 - Operating Systems and Systems Programming. Address Translation => Paging"

CS5460: Operating Systems Lecture 14: Memory Management (Chapter 8)

CSE 120 Principles of Operating Systems

Operating Systems. Operating Systems Sina Meraji U of T

CSE 120 Principles of Operating Systems Spring 2017

CS 318 Principles of Operating Systems

CSE 451: Operating Systems Winter Page Table Management, TLBs and Other Pragmatics. Gary Kimura

SE-292 High Performance Computing. Memory Hierarchy. R. Govindarajan

Virtual Memory 2. q Handling bigger address spaces q Speeding translation

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner

Virtual Memory: From Address Translation to Demand Paging

Memory: Page Table Structure. CSSE 332 Operating Systems Rose-Hulman Institute of Technology

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

Memory Management. Goals of Memory Management. Mechanism. Policies

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 12, 2018 L16-1

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1

Multi-level Translation. CS 537 Lecture 9 Paging. Example two-level page table. Multi-level Translation Analysis

Simple idea 1: load-time linking. Our main questions. Some terminology. Simple idea 2: base + bound register. Protection mechanics.

Page Tables. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CS 3733 Operating Systems:

Learning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory.

Learning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory.

Virtual Memory 2. To do. q Handling bigger address spaces q Speeding translation

Recall: Address Space Map. 13: Memory Management. Let s be reasonable. Processes Address Space. Send it to disk. Freeing up System Memory

MEMORY MANAGEMENT/1 CS 409, FALL 2013

Recap: Memory Management

Memory Management Topics. CS 537 Lecture 11 Memory. Virtualizing Resources

Virtual Memory Virtual memory first used to relive programmers from the burden of managing overlays.

CS 134: Operating Systems

Agenda. CS 61C: Great Ideas in Computer Architecture. Virtual Memory II. Goals of Virtual Memory. Memory Hierarchy Requirements

Virtual Memory 2. Today. Handling bigger address spaces Speeding translation

Computer Science 146. Computer Architecture

Virtual to physical address translation

Virtual Memory. Today. Handling bigger address spaces Speeding translation

1. Creates the illusion of an address space much larger than the physical memory

Virtual Memory: From Address Translation to Demand Paging

CSE 4/521 Introduction to Operating Systems. Lecture 14 Main Memory III (Paging, Structure of Page Table) Summer 2018

SMD149 - Operating Systems - Memory

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18

Virtual Memory. CS 3410 Computer System Organization & Programming. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]

Reducing Hit Times. Critical Influence on cycle-time or CPI. small is always faster and can be put on chip

Computer Systems Architecture I. CSE 560M Lecture 18 Guest Lecturer: Shakir James

CS307 Operating Systems Main Memory

A Typical Memory Hierarchy

Chapter 8 Memory Management

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems

Virtual memory - Paging

The process. one problem

Main Memory: Address Translation

Virtual Memory. control structures and hardware support

CIS Operating Systems Memory Management Address Translation for Paging. Professor Qiang Zeng Spring 2018

Virtualizing Memory: Paging. Announcements

Virtual Memory. CS 351: Systems Programming Michael Saelee

CS370 Operating Systems

COSC3330 Computer Architecture Lecture 20. Virtual Memory

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1

Memory Management. Dr. Yingwu Zhu

Virtual Memory. CS 3410 Computer System Organization & Programming

A Typical Memory Hierarchy

CSE 351. Virtual Memory

Operating Systems, Fall

Virtual Memory. Samira Khan Apr 27, 2017

Operating Systems, Fall

Virtual or Logical. Logical Addr. MMU (Memory Mgt. Unit) Physical. Addr. 1. (50 ns access)

CS 153 Design of Operating Systems

Virtual Memory Oct. 29, 2002

16 Sharing Main Memory Segmentation and Paging

Memory Hierarchy Requirements. Three Advantages of Virtual Memory

Virtual Memory, Address Translation

Learning to Play Well With Others

Lecture 21: Virtual Memory. Spring 2018 Jason Tang

Virtual Memory. Kevin Webb Swarthmore College March 8, 2018

CS399 New Beginnings. Jonathan Walpole

Operating Systems. Paging... Memory Management 2 Overview. Lecture 6 Memory management 2. Paging (contd.)

CS 333 Introduction to Operating Systems. Class 11 Virtual Memory (1) Jonathan Walpole Computer Science Portland State University

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs

20-EECE-4029 Operating Systems Spring, 2013 John Franco

198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14

CHAPTER 4 MEMORY HIERARCHIES TYPICAL MEMORY HIERARCHY TYPICAL MEMORY HIERARCHY: THE PYRAMID CACHE PERFORMANCE MEMORY HIERARCHIES CACHE DESIGN

Another View of the Memory Hierarchy. Lecture #25 Virtual Memory I Memory Hierarchy Requirements. Memory Hierarchy Requirements

1. With respect to space, linked lists are and arrays are.

ECE519 Advanced Operating Systems

Virtual memory Paging

CSC 369 Operating Systems

Virtual Memory. Virtual Memory

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation

Main Memory (Part II)

Computer Systems. Virtual Memory. Han, Hwansoo

Chapter 3 - Memory Management

EECS 470. Lecture 16 Virtual Memory. Fall 2018 Jon Beaumont

Carnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition

390 Chapter 8 Main Memory

Opera&ng Systems ECE344

CS 61C: Great Ideas in Computer Architecture. Virtual Memory

Multi-Process Systems: Memory (2) Memory & paging structures: free frames. Memory & paging structures. Physical memory

Transcription:

Lecture 13: Virtual Memory Management CSC 469H1F Fall 2006 Angela Demke Brown

Topics Review virtual memory basics Large (64-bit) virtual address spaces Multiple Page Sizes Placement policy and cache effects NUMA multiprocessor memory management Distributed shared memory

Memory Management Requirements Relocation Programmers don t know what physical memory will be available when their programs run need some type of address translation Protection A process s memory should be protected from unwanted access by other processes, both intentional and accidental Requires hardware support Sharing Need ways to specify and control what sharing is allowed Logical/Physical Organization Map between program structures and linear array of bytes Manage transfers between disk and main memory

0xFFFFFFFF System Addresses 0x80000000 0x7FFFFFFF User Addresses 0x00000000 Virtual address space Operating System Code and Data Stack Heap (Dyanamic Memory Alloc) Static Data Segment) Code (Text Segment) SP PC process address space (A.S.) layout logical or virtual A.S. CPU generates logical addresses in this space as program executes Called virtual addresses Memory system must see physical (real) addrs Translation is done by memory management unit (MMU) Physical memory must be allocated for each virtual location used by the program

Paging Partition memory into equal, fixed-size chunks called page frames or simply frames Divide processes memory into chunks of the same size These are called pages Any page can be assigned to any free page frame No external fragmentation Minimal internal fragmentation First seen in CTSS circa 1961 Demand paging (automatic transfer to/from backing store) first used in the Atlas computer Described in a 2-page CACM article, 1961

Atlas virtual memory Inverted page table (entry per physical page, records what virtual page is stored there) Only 2048 entries, stored in registers, searched in parallel Missing pages fetched on demand from drum into core Victim also selected on demand

Typical Address Translation Physical Memory Virtual Address Page number Offset Page table Page frame Physical Address Page frame Offset

Page tables space limitations Memory required for page table can be large Need one PTE per page 32 bit virtual address space w/ 4K pages = 2 20 PTEs 4 bytes/pte = 4MB/page table 25 processes = 100MB just for page tables! Solution 1: Hierarchical page tables Physical Memory Virtual Address Master page number Secondary Offset Page table Physical Address Page frame Offset Master Page Table Page frame Secondary Page Table

64-bit address spaces Suppose we just extended the hierarchical page tables with more levels 4K pages 52 bits for page numbers Maximum 1024 entries per level 6 levels Too much overhead 16K pages 48 bits for page numbers Maximum 4096 entries per level -> 4 levels Better, but still a lot A new page table for 64-bit address spaces, Talluri, Hill & Khalidi, SOSP 95 Introduces clustered page tables, building on the concept of hashed page tables

Recall Hashed Page Tables Hash function maps virtual page number (VPN) to bucket in fixed-size hash table Search entries at that bucket for matching VPN Physical Memory Virtual Address Page number Offset Hash function Page hash table Physical Address Page frame Offset VPN PTE next VPN PTE next VPN PTE next

Hashed Page Tables Hash table should have 1 bucket per physical page to keep expected chain length short Overhead is fixed, good for sparse address spaces Overhead is high (200%, or 16 bytes for 8 bytes of mapping info) Next field can be eliminated with fixed number of PTEs per bucket (PowerPC) Want fixed, low overhead for both sparse and dense address spaces

VPN Next PTE0 PTE1 PTE2 PTE3 VPN Next PTE0 PTE1 PTE2 PTE3 Clustered page tables Similar to hashed page tables But each entry stores mapping information for several consecutive pages with a single key Hashed page tables with subblocking Virtual Address Virt. Pg Block No. (VPBN) Boff Offset Hash function Page hash table Physical Address Page frame Offset Clustered PTE (subblock factor 4) VPN Next PTE0 PTE1 PTE2 PTE3

Clustered Page Tables Less overhead than hashed page tables E.g. subblock factor 16, 18 64-bit words 144 bytes per clustered PTE Break even if 6 mappings used (same overhead as hashed p.t.) Roughly 1/3 less space if all mappings used Can use more space if address space is very sparse Use smaller subblock factor Smaller hash table or shorter chains more efficient access But can be worse if PTEs span multiple cache lines

Page tables time overhead Each virtual memory reference requires multiple physical memory references to complete 1 per level in hierarchical tables + actual data access Solution: cache recently used translations in MMU Translation lookaside buffer (TLB) Fully associative cache (all entries looked up in parallel) Indexed by virtual page numbers entries are PTEs (entries from page tables) With PTE + offset, can directly calculate physical address

TLB performance TLB hit rates critical to performance TLB reach == fraction of the virtual address space covered by the TLB Depends on page size, number of TLB entries TLB size is fixed (typically small, 2048 entries or less) 4 KB page TLB reach is 2048*4K = 8 MB 16 KB page TLB reach is 64 MB Miniscule compared to data sets used by applications today Just using a larger page size for everything is problematic Internal fragmentation Solution: support multiple page sizes

Superpage TLBs Superpages: page sizes are power-of-two multiples of the base page size Must be aligned in both virtual and physical memory (e.g. 4 MB superpage must begin on a 4 MB address boundary in both spaces) TLB entry (copy of PTE) includes page size Supported by MMU s in many processors MIPS, UltraSPARC, Alpha, PowerPC Itanium II sizes: 4K, 8K, 16K, 64K, 256K, 1M, 4M, 16M, 64M, 256M, 1G, 4G

Subblock TLBs Subblocking associates multiple physical page numbers (PPN) with each TLB tag TLB tag is Virtual page block number (VPBN) Subblocks must be aligned in virtual address space, but each virtual page has a separate PPN so they need not be aligned in physical space Supported by MIPS R4x00 processors (subblock factor of 2) Increases size of TLB entry vs. superpages Partial subblocking blends ideas TLB entry stores only one PPN, but multiple valid bits subblocks must be aligned, but not all pages must be valid

Pentium Address Translation