Virtual Memory. Main memory is a CACHE for disk Advantages: illusion of having more physical memory program relocation protection.

Similar documents
Chapter Seven. Memories: Review. Exploiting Memory Hierarchy CACHE MEMORY AND VIRTUAL MEMORY

CPU issues address (and data for write) Memory returns data (or acknowledgment for write)

Chapter Seven Morgan Kaufmann Publishers

Chapter Seven. SRAM: value is stored on a pair of inverting gates very fast but takes up more space than DRAM (4 to 6 transistors)

Locality. Cache. Direct Mapped Cache. Direct Mapped Cache

Chapter 5 Large and Fast: Exploiting Memory Hierarchy (Part 2)

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

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

LECTURE 12. Virtual Memory

Virtual Memory. Virtual Memory

A Framework for Memory Hierarchies

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

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy

CSE 141 Computer Architecture Spring Lectures 17 Virtual Memory. Announcements Office Hour

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

Page 1. Multilevel Memories (Improving performance using a little cash )

ECE 571 Advanced Microprocessor-Based Design Lecture 13

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

Handout 4 Memory Hierarchy

Lecture 17: Virtual Memory, Large Caches. Today: virtual memory, shared/pvt caches, NUCA caches

Lecture: Large Caches, Virtual Memory. Topics: cache innovations (Sections 2.4, B.4, B.5)

Page 1. Review: Address Segmentation " Review: Address Segmentation " Review: Address Segmentation "

Virtual Memory. CS 3410 Computer System Organization & Programming

Lecture 8: Virtual Memory. Today: DRAM innovations, virtual memory (Sections )

COEN-4730 Computer Architecture Lecture 3 Review of Caches and Virtual Memory

ECE331: Hardware Organization and Design

Memory Hierarchy Requirements. Three Advantages of Virtual Memory

Memory systems. Memory technology. Memory technology Memory hierarchy Virtual memory

1/19/2009. Data Locality. Exploiting Locality: Caches

Virtual to physical address translation

Computer Architecture. Lecture 8: Virtual Memory

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

ADMIN. SI232 Set #18: Caching Finale and Virtual Reality (Chapter 7) Down the home stretch. Split Caches. Final Exam Monday May 1 (first exam day)

Performance! (1/latency)! 1000! 100! 10! Capacity Access Time Cost. CPU Registers 100s Bytes <10s ns. Cache K Bytes ns 1-0.

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

CS61C : Machine Structures

Topic 18: Virtual Memory

Sarah L. Harris and David Money Harris. Digital Design and Computer Architecture: ARM Edition Chapter 8 <1>

Systems Programming and Computer Architecture ( ) Timothy Roscoe

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

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

Lecture 24: Memory, VM, Multiproc

CS162 Operating Systems and Systems Programming Lecture 10 Caches and TLBs"

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Page 1. Goals for Today" TLB organization" CS162 Operating Systems and Systems Programming Lecture 11. Page Allocation and Replacement"

John Wawrzynek & Nick Weaver

ECE468 Computer Organization and Architecture. Virtual Memory

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Memory hier ar hier ch ar y ch rev re i v e i w e ECE 154B Dmitri Struko Struk v o

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

ECE4680 Computer Organization and Architecture. Virtual Memory

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 7: Memory Organization Part II

Pipelined processors and Hazards

Chapter 5 (Part II) Large and Fast: Exploiting Memory Hierarchy. Baback Izadi Division of Engineering Programs

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

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

ECE 571 Advanced Microprocessor-Based Design Lecture 12

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

Virtual Memory: From Address Translation to Demand Paging

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

5 Solutions. Solution a. no solution provided. b. no solution provided

Virtual Memory. Reading. Sections 5.4, 5.5, 5.6, 5.8, 5.10 (2) Lecture notes from MKP and S. Yalamanchili

CS162 Operating Systems and Systems Programming Lecture 14. Caching (Finished), Demand Paging

Solutions for Chapter 7 Exercises

Computer Systems. Virtual Memory. Han, Hwansoo

Processes and Virtual Memory Concepts

Memory Technologies. Technology Trends

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

Lecture 21: Virtual Memory. Spring 2018 Jason Tang

EN1640: Design of Computing Systems Topic 06: Memory System

ECE 598 Advanced Operating Systems Lecture 14

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Paging! 2/22! Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2012! " (0xE0)" " " " (0x70)" " (0x50)"

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

ECE331: Hardware Organization and Design

Recall from Tuesday. Our solution to fragmentation is to split up a process s address space into smaller chunks. Physical Memory OS.

Memory Management. Dr. Yingwu Zhu

Background. Memory Hierarchies. Register File. Background. Forecast Memory (B5) Motivation for memory hierarchy Cache ECC Virtual memory.

Textbook: Burdea and Coiffet, Virtual Reality Technology, 2 nd Edition, Wiley, Textbook web site:

Memory Management! How the hardware and OS give application pgms:" The illusion of a large contiguous address space" Protection against each other"

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

CISC 662 Graduate Computer Architecture Lecture 16 - Cache and virtual memory review

Alexandria University

Virtual Memory. Stefanos Kaxiras. Credits: Some material and/or diagrams adapted from Hennessy & Patterson, Hill, online sources.

Readings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001.

Virtual Memory - Objectives

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

Virtual Memory: From Address Translation to Demand Paging

CSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management

CS61C : Machine Structures

Lecture 24: Virtual Memory, Multiprocessors

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

I, J A[I][J] / /4 8000/ I, J A(J, I) Chapter 5 Solutions S-3.

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

www-inst.eecs.berkeley.edu/~cs61c/

Lecture 12. Memory Design & Caches, part 2. Christos Kozyrakis Stanford University

EITF20: Computer Architecture Part 5.1.1: Virtual Memory

LECTURE 4: LARGE AND FAST: EXPLOITING MEMORY HIERARCHY

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

Computer Architecture A Quantitative Approach, Fifth Edition. Chapter 2. Memory Hierarchy Design. Copyright 2012, Elsevier Inc. All rights reserved.

Transcription:

Virtual Memory Main memory is a CACHE for disk Advantages: illusion of having more physical memory program relocation protection L18 Virtual Memory 1

Pages: Virtual Memory Blocks Page faults: the data is not in memory, retrieve it from disk huge miss penalty (remember months at human scale) Pages should be fairly large (e.g., 4KB) Find something else to do while waiting reducing page faults is important (LRU is worth the price) can handle the faults in software instead of hardware using write-through is too expensive so we use writeback L18 Virtual Memory 2

Page Tables L18 Virtual Memory 3

Page Tables One page table per process! L18 Virtual Memory 4

Where are the page tables? Page tables are potentially BIG 4kB page, 4MB program, 1k page table entries per program! Chrome 36 instances ranging from 401MB to 50MB Compiz 255MB Dropbox 205MB Remmina 93MB Xorg 87MB Lots More Processes! Page the page tables! Have to look up EVERY address! L18 Virtual Memory 5

Making Address Translation Fast TLB = Translation Lookaside Buffer a CACHE for address translation L18 Virtual Memory 6

What is in the page table? Address = upper bits of physical memory address OR disk address of page if not in memory Valid = bit, set if page is in memory Use = bit, set when page is accessed Protection = bit (or bits) to specify access permissions Dirty = bit, set if page has been written L18 Virtual Memory 7

Integrating TLB and Cache L18 Virtual Memory 8

Program Relocation? We want to run multiple programs on our computer simultaneously To start a new program Without Virtual Memory: We have to modify all the address references to correspond to the range chosen. This is relocation. With Virtual Memory: EVERY program can pretend that it has ALL of memory. TEXT segment always starts at 0, STACK always resides a some huge high address (0xfffffff0) L18 Virtual Memory 9

Protection? We d like to protect one program from the errors of another Without Virtual Memory (old Macs, win3-) One program goes bad (or the programmer makes a mistake) and kills another program or the whole system! With Virtual Memory (new Macs, win95+) Every program is isolated from every other. You can t even NAME the addresses in another program. Each page can have read, write, and execute permissions L18 Virtual Memory 10

Some Issues Processor speeds continue to increase much faster than either DRAM or disk access times Design challenge: dealing with this growing disparity Trends: synchronous SRAMs (provide a burst of data) redesign DRAM chips to provide higher bandwidth or processing restructure code to increase locality use prefetching (make cache visible to ISA) L18 Virtual Memory 11

What cache and VM have in common Question 1: Where can a block be placed? Question 2: How is a block found? Question 3: Which block should be replaced on a cache miss? Question 4: What happens on a write? L18 Virtual Memory 12

Where can a block be placed? Direct Mapped Cache: only 1 place for any block (many blocks map to the same place) 2-Way Set Associative: 2 places for any block 4-Way Set Associative: 4 places for any block Fully Associative: anywhere Virtual Memory: anywhere L18 Virtual Memory 13

How is a block found? Direct mapped cache: compute the index Set associative cache: compute the index, then search Fully associative cache: search all cache entries Virtual memory: separate lookup table L18 Virtual Memory 14

Which block is replaced on miss? Direct mapped cache have no choice Others can use: Random replacement Least Recently Used (LRU) Other schemes L18 Virtual Memory 15

What happens on write? Write-through: write to both the cache and the next lower level Write-back: write only to the cache, remember that we have to write to the lower level on replacement L18 Virtual Memory 16

Misses Compulsory misses Capacity misses Conflict misses L18 Virtual Memory 17