Virtual Memory Nov 9, 2009"

Similar documents
Virtual Memory Oct. 29, 2002

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

CISC 360. Virtual Memory Dec. 4, 2008

Motivations for Virtual Memory Virtual Memory Oct. 29, Why VM Works? Motivation #1: DRAM a Cache for Disk

virtual memory. March 23, Levels in Memory Hierarchy. DRAM vs. SRAM as a Cache. Page 1. Motivation #1: DRAM a Cache for Disk

virtual memory Page 1 CSE 361S Disk Disk

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

Random-Access Memory (RAM) Systemprogrammering 2007 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics

Random-Access Memory (RAM) Systemprogrammering 2009 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics! The memory hierarchy

P6/Linux Memory System Nov 11, 2009"

Computer Systems. Virtual Memory. Han, Hwansoo

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

CSE 153 Design of Operating Systems

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

Carnegie Mellon. 16 th Lecture, Mar. 20, Instructors: Todd C. Mowry & Anthony Rowe

14 May 2012 Virtual Memory. Definition: A process is an instance of a running program

Pentium/Linux Memory System March 17, 2005

Processes and Virtual Memory Concepts

Memory System Case Studies Oct. 13, 2008

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory II CSE 351 Spring

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory. Alan L. Cox Some slides adapted from CMU slides

Virtual Memory: Concepts

Virtual Memory: Systems

This lecture. Virtual Memory. Virtual memory (VM) CS Instructor: Sanjeev Se(a

Virtual Memory: Concepts

CSE 560 Computer Systems Architecture

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Lecture 19: Virtual Memory: Concepts

University of Washington Virtual memory (VM)

Foundations of Computer Systems

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Virtual Memory. Samira Khan Apr 27, 2017

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24

VM as a cache for disk

A Few Problems with Physical Addressing. Virtual Memory Process Abstraction, Part 2: Private Address Space

CSE 351. Virtual Memory

Problem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses.

CS 153 Design of Operating Systems

Intel P The course that gives CMU its Zip! P6/Linux Memory System November 1, P6 memory system. Review of abbreviations

Virtual Memory. CS61, Lecture 15. Prof. Stephen Chong October 20, 2011

Intel P6 (Bob Colwell s Chip, CMU Alumni) The course that gives CMU its Zip! Memory System Case Studies November 7, 2007.

Virtual Memory: Concepts

P6 memory system P6/Linux Memory System October 31, Overview of P6 address translation. Review of abbreviations. Topics. Symbols: ...

Understanding the Design of Virtual Memory. Zhiqiang Lin

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

Virtual Memory: Systems

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

Topic 18: Virtual Memory

Virtual Memory. Physical Addressing. Problem 2: Capacity. Problem 1: Memory Management 11/20/15

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

EE108B Lecture 13. Caches Wrap Up Processes, Interrupts, and Exceptions. Christos Kozyrakis Stanford University

Announcements. EE108B Lecture 13. Caches Wrap Up Processes, Interrupts, and Exceptions. Measuring Performance. Memory Performance

Virtual Memory I. CSE 351 Spring Instructor: Ruth Anderson

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

Virtual Memory: From Address Translation to Demand Paging

Virtual Memory. Computer Systems Principles

Virtual Memory, Address Translation

Memory Hierarchy Requirements. Three Advantages of Virtual Memory

CS 153 Design of Operating Systems

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

Virtual Memory, Address Translation

Page Which had internal designation P5

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

Virtual to physical address translation

ADDRESS TRANSLATION AND TLB

University*of*Washington*

CS 261 Fall Mike Lam, Professor. Virtual Memory

18-447: Computer Architecture Lecture 16: Virtual Memory

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

Memory Hierarchy. Goal: Fast, unlimited storage at a reasonable cost per bit.

Virtual Memory. CS 351: Systems Programming Michael Saelee

Virtual Memory. Virtual Memory

Topic 18 (updated): Virtual Memory

Computer Structure. X86 Virtual Memory and TLB

UC Berkeley CS61C : Machine Structures

Virtual Memory. CS 3410 Computer System Organization & Programming

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

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

Chapter 8. Virtual Memory

Virtual Memory. User memory model so far:! In reality they share the same memory space! Separate Instruction and Data memory!!

ELE 758 * DIGITAL SYSTEMS ENGINEERING * MIDTERM TEST * Circle the memory type based on electrically re-chargeable elements

Virtual Memory - Objectives

COSC3330 Computer Architecture Lecture 20. Virtual Memory

ADDRESS TRANSLATION AND TLB

6.004 Tutorial Problems L20 Virtual Memory

CS 5523 Operating Systems: Memory Management (SGG-8)

ECE232: Hardware Organization and Design

Memory Hierarchy. Mehran Rezaei

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

CS252 S05. Main memory management. Memory hardware. The scale of things. Memory hardware (cont.) Bottleneck

Computer Science 146. Computer Architecture

CS 61C: Great Ideas in Computer Architecture Virtual Memory. Instructors: John Wawrzynek & Vladimir Stojanovic

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory. Bernhard Boser & Randy Katz

VIRTUAL MEMORY: CONCEPTS

Virtual Memory III /18-243: Introduc3on to Computer Systems 17 th Lecture, 23 March Instructors: Bill Nace and Gregory Kesden

Virtual Memory 3. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. P & H Chapter 5.4

Virtual Memory I. CSE 351 Winter Instructor: Mark Wyse

Virtual Memory: From Address Translation to Demand Paging

Transcription:

Virtual Memory Nov 9, 2009"

Administrivia" 2!

3! Motivations for Virtual Memory"

Motivation #1: DRAM a Cache for Disk" SRAM" DRAM" Disk" 4!

Levels in Memory Hierarchy" cache! virtual memory! CPU" regs" C" 8 B! a" 32 B! 4 KB! Memory! c" h" e" disk" size:! speed:! $/Mbyte:! line size:! Register " Cache" Memory" Disk Memory" 32 B! 1 ns! 8 B! 32 KB-4MB! 2 ns! $30/MB! 32 B! 1024 MB! 30 ns! $0.02/MB! 4 KB! 100 GB! 8 ms! $0.001/MB! larger, slower, cheaper! 5!

DRAM vs. SRAM as a Cache " SRAM" DRAM" Disk" 6!

Impact of Properties on Design" 7!

Locating an Object in a Cache " Cache " Tag" Data" Object Name! X" = X?! 0:" 1:" N-1:" D" 243" X" 17" J" 105" 8!

Locating an Object in Cache (cont.)" Page Table" Cache " 9! Object Name! X" D:" Location" 0" J:" On Disk" X:" 1" 0:" 1:" N-1:" Data" 243" 17" 105"

A System with Physical Memory Only" Physical! Addresses" Memory" 0:" 1:" CPU" 10! N-1:" Addresses generated by the CPU correspond directly to bytes in physical memory"

A System with Virtual Memory" Memory" Virtual! Addresses" Page Table" 0:" 1:" Physical! Addresses" 0:" 1:" CPU" P-1:" N-1:" Disk" Address Translation: Hardware converts virtual addresses to physical addresses via OS-managed lookup table (page table)" 11!

Page Faults (like Cache Misses )" CPU" Virtual! Addresses" Before fault" Page Table" Physical! Addresses" Memory" CPU" Virtual! Addresses" After fault" Page Table" Physical! Addresses" Memory" 12! Disk" Disk"

Servicing a Page Fault" (1) Initiate Block Read! Processor! Reg" (3) Read Done! Cache! Memory! Memory-I/O bus! (2) DMA Transfer! I/O! controller! disk! Disk! disk! Disk! 13!

Motivation #2: Memory Management" %esp" kernel virtual memory" stack" memory invisible to" user code" 14! Linux/x86 process" memory " image" 0" Memory mapped region " forshared libraries" runtime heap (via malloc)" uninitialized data (.bss)" initialized data (.data)" program text (.text)" forbidden" the brk ptr"

Solution: Separate Virt. Addr. Spaces" Virtual and physical address spaces divided into equal-sized blocks" blocks are called pages (both virtual and physical)" Each process has its own virtual address space" operating system controls how virtual pages as assigned to physical memory" Virtual Address Space for Process 1:! 0" N-1" VP 1" VP 2"..." Address Translation" 0" PP 2" Physical! Address! Space (DRAM)! 15! Virtual Address Space for Process 2:! 0" N-1" VP 1" VP 2"..." M-1" PP 7" PP 10" (e.g., read/only library code)"

Contrast: Macintosh Memory Model" P1 Pointer Table! Shared Address Space! Process P1! A" B" Handles " Process P2! P2 Pointer Table! C" D" E" 16!

Macintosh Memory Management" Process P1! P1 Pointer Table! Shared Address Space! B" Handles " P2 Pointer Table! Process P2! 17! A" C" D" E"

Mac vs. VM-Based Memory Mgmt" 18!

19! MAC OS X"

Motivation #3: Protection" Process i:" Page Tables" Read?" Write?" Physical Addr" VP 0:" Yes" No" PP 9" VP 1:" Yes" Yes" PP 4" 0:" 1:" Memory" Process j:" VP 2:" No" No" Read?" Write?" VP 0:" VP 1:" Yes" Yes" Yes" No" XXXXXXX" Physical Addr" PP 6" PP 9" N-1:" 20! VP 2:" No" No" XXXXXXX"

VM Address Translation" 21!

VM Address Translation: Hit" Processor" a" Hardware" Addr Trans" Mechanism" a'" Main" Memory" virtual address" part of the " on-chip" physical address" memory mgmt unit (MMU)" 22!

VM Address Translation: Miss" Processor" a" Hardware" Addr Trans" Mechanism" " a'" page fault! fault" handler" Main" Memory" virtual address" part of the " physical address" on-chip" memory mgmt unit (MMU)" Secondary memory, Disk" OS performs" this transfer" (only if miss)" 23!

VM Address Translation" n 1! p! p 1! 0! virtual page number! page offset! virtual address" address translation! m 1! p! p 1! 0! physical page number! page offset! physical address" Page offset bits donʼt change as a result of translation" 24!

Page Tables" Virtual Page" Number" Valid" 1" 1" 0" 1" 1" 1" 0" 1" 0" 1" Memory resident" page table" (physical page " or disk address)" Physical Memory" Disk Storage" (swap file or" regular file system file)" 25!

Address Translation via Page Table" page table base register" VPN acts as" table index" virtual address" n 1" p" p 1" 0" virtual page number (VPN)" page offset" valid" access" physical page number (PPN)" if valid=0" then page" not in memory" m 1" p" p 1" physical page number (PPN)" page offset" physical address" 0" 26!

27! Page Table Operation"

28! Page Table Operation"

29! Page Table Operation"

Integrating VM and Cache" CPU! VA! PA! miss! Trans-! Cache! lation! data! hit! Main! Memory! 30!

Speeding up Translation with a TLB" CPU! hit! VA! PA! miss! TLB! Cache! Lookup! Main! Memory! miss! hit! Trans-! lation! data! 31!

Address Translation with a TLB" n 1" p" p 1" 0" virtual page number" page offset" virtual address" valid" tag" physical page number"."."." TLB" TLB hit" =" physical address" tag" valid" tag" data" index" byte offset" Cache" cache hit" 32! =" data"

Simple Memory System Example" 13" 12" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" VPN" (Virtual Page Number)! VPO" (Virtual Page Offset)! 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" PPN" (Physical Page Number)! PPO" (Physical Page Offset)! 33!

Simple Memory System Page Table" Only show first 16 entries (no protection information)" 34!

Simple Memory System TLB" TLBT" TLBI" 13" 12" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" VPN" VPO" 35!

Simple Memory System Cache" CT" CI" CO" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" PPN" PPO" 36!

Address Translation Example #1" TLBT" TLBI" 13" 12" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" VPN" VPO" CT" CI" CO" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" PPN" PPO" 37!

Address Translation Example #2" TLBT" TLBI" 13" 12" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" VPN" VPO" CT" CI" CO" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" PPN" PPO" 38!

Address Translation Example #3" TLBT" TLBI" 13" 12" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" VPN" VPO" CT" CI" CO" 11" 10" 9" 8" 7" 6" 5" 4" 3" 2" 1" 0" PPN" PPO" 39!

Multi-Level Page Tables" Level 2" Tables" Level 1" Table"..." 40!

Main Themes" 41!