ADDRESS TRANSLATION AND TLB

Similar documents
ADDRESS TRANSLATION AND TLB

CACHE ARCHITECTURE. Mahdi Nazm Bojnordi. CS/ECE 6810: Computer Architecture. Assistant Professor School of Computing University of Utah

CACHE ARCHITECTURE. Mahdi Nazm Bojnordi. CS/ECE 6810: Computer Architecture. Assistant Professor School of Computing University of Utah

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

ECE232: Hardware Organization and Design

MEMORY HIERARCHY DESIGN

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

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

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

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

CS 153 Design of Operating Systems Winter 2016

LECTURE 12. Virtual Memory

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

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

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

Virtual Memory, Address Translation

Virtual Memory, Address Translation

CACHE OPTIMIZATION. Mahdi Nazm Bojnordi. CS/ECE 6810: Computer Architecture. Assistant Professor School of Computing University of Utah

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

Virtual Memory. Virtual Memory

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

CACHE OPTIMIZATION. Mahdi Nazm Bojnordi. CS/ECE 6810: Computer Architecture. Assistant Professor School of Computing University of Utah

Virtual Memory Nov 9, 2009"

Virtual to physical address translation

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

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

V. Primary & Secondary Memory!

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

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

Virtual Memory: From Address Translation to Demand Paging

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

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

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

CPSC 330 Computer Organization

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

ECE 571 Advanced Microprocessor-Based Design Lecture 13

Virtual Memory - Objectives

CSE 351. Virtual Memory

ECE331: Hardware Organization and Design

ECE 571 Advanced Microprocessor-Based Design Lecture 12

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

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy

Virtual Memory Overview

virtual memory Page 1 CSE 361S Disk Disk

Virtual Memory. CS 3410 Computer System Organization & Programming

Virtual Memory II CSE 351 Spring

EN1640: Design of Computing Systems Topic 06: Memory System

Virtual Memory Review. Page faults. Paging system summary (so far)

Computer Architecture. R. Poss

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

Memory Management. Goals of Memory Management. Mechanism. Policies

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

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

Topic 18: Virtual Memory

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

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

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

lecture 18 cache 2 TLB miss TLB - TLB (hit and miss) - instruction or data cache - cache (hit and miss)

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

VIRTUAL MEMORY II. Jo, Heeseung

ENGN 2910A Homework 03 (140 points) Due Date: Oct 3rd 2013

MEMORY MANAGEMENT UNITS

c. What are the machine cycle times (in nanoseconds) of the non-pipelined and the pipelined implementations?

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

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

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

EITF20: Computer Architecture Part 5.1.1: Virtual Memory

Memory. Principle of Locality. It is impossible to have memory that is both. We create an illusion for the programmer. Employ memory hierarchy

Main Memory (Fig. 7.13) Main Memory

Pipelined processors and Hazards

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

BRANCH PREDICTORS. Mahdi Nazm Bojnordi. CS/ECE 6810: Computer Architecture. Assistant Professor School of Computing University of Utah

COMP 3221: Microprocessors and Embedded Systems

Lecture 21: Virtual Memory. Spring 2018 Jason Tang

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

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)

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

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

Virtual Memory. Kevin Webb Swarthmore College March 8, 2018

CSCI 402: Computer Architectures. Fengguang Song Department of Computer & Information Science IUPUI. Recall

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

The Memory Hierarchy Cache, Main Memory, and Virtual Memory

CS399 New Beginnings. Jonathan Walpole

Module 2: Virtual Memory and Caches Lecture 3: Virtual Memory and Caches. The Lecture Contains:

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

ECE 341. Lecture # 18

COSC 6385 Computer Architecture. - Memory Hierarchies (I)

Computer Science 146. Computer Architecture

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

Virtual Memory Oct. 29, 2002

Virtual Memory: From Address Translation to Demand Paging

CS 537 Lecture 6 Fast Translation - TLBs

ECE 598 Advanced Operating Systems Lecture 14

Chapter 8. Virtual Memory

Pipelining Exercises, Continued

Translation Buffers (TLB s)

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 5. Large and Fast: Exploiting Memory Hierarchy

CSE 2021: Computer Organization

Improving Memory Access The Cache and Virtual Memory

Transcription:

ADDRESS TRANSLATION AND TLB Mahdi Nazm Bojnordi Assistant Professor School of Computing University of Utah CS/ECE 6810: Computer Architecture

Overview Announcement Homework 3 submission deadline: Nov. 11 th This lecture Virtual memory tables and address translation Translation look-aside buffer (TLB)

Recall: Memory Hierarchy Lower levels provide greater capacity longer time Does the program fit in main memory? What if running multiple programs? Cache Capacity: 8MB Time: ~20 ns Greater Capacity Main Memory Capacity: 8GB Time: ~250 ns Secondary Memory Capacity: 500GB Time: ~10 ms

Virtual Memory Use the main memory as a cache for secondary memory Placement policy? Main Memory for(i=0; i<100;++i) { a[i]++; } Disk

Virtual Memory Use the main memory as a cache for secondary memory Placement policy? Allow efficient and safe sharing the physical main memory among multiple programs Replacement policy? Main Memory for(i=0; i<100;++i) { a[i]++; } Disk for(i=0; i<200;++i) { a[i]=a[i]+i; }

Virtual Memory Systems Provides illusion of very large memory Address space of each program larger than the physical main memory Memory management unit (MMU) Between main and secondary mem. Address translation n Virtual address space used by the program n Physical address space is provided by the physical main memory App Virtual Address Space Secondary Memory

Virtual Memory Systems Provides illusion of very large memory Address space of each program larger than the physical main memory Memory management unit (MMU) Between main and secondary mem. Address translation n Virtual address space used by the program n Physical address space is provided by the physical main memory App Virtual Address Space Translation Main Memory Secondary Memory

Virtual Address Every virtual address is translated to a physical address with the help of hardware Data granularity 31 Virtual Address 0 Physical Memory 0 29 Physical Address 0 1G

Virtual Address Every virtual address is translated to a physical address with the help of hardware Data granularity 31 Virtual Address 0 29 Physical Address 0 Physical Memory 0 Frame 0 Frame 1 Frame 2 Frame N-1 1G

Virtual Address Every virtual address is translated to a physical address with the help of hardware Data granularity 31 Virtual Address 0 offset 29 Physical Address 0 offset Physical Memory 0 Frame 0 Frame 1 Frame 2 Frame N-1 1G

Virtual Address Every virtual address is translated to a physical address with the help of hardware Data granularity 31 Virtual Address 0 Virtual No offset Translator 29 Physical Address 0 frame No offset Physical Memory 0 Frame 0 Frame 1 Frame 2 Frame N-1 1G

Virtual Address Every virtual address is translated to a physical address with the help of hardware Data granularity 31 Virtual Address 0 Virtual No offset 29 Physical Address 0 frame No offset Physical Memory 0 Frame 0 Frame 1 Frame 2 Table What is the table size? Frame N-1 1G

Address Translation Issues Where to store the table? Too big for on-chip cache Should be maintained in the main memory

Address Translation Issues Where to store the table? Too big for on-chip cache Should be maintained in the main memory What to do on a page table miss (page fault)? No valid frame assigned to the virtual page OS copies the page from disk to page frame

Address Translation Issues Where to store the table? Too big for on-chip cache Should be maintained in the main memory What to do on a page table miss (page fault)? No valid frame assigned to the virtual page OS copies the page from disk to page frame What is the cost of address translation? Additional accesses to main memory per every access Optimizations?

Address Translation Cost walk: look up the physical address in the page table How many pages to store the page table? Virtual Address 20 12 baseà frame No 12 Table Physical Address

Multi-Level Table The virtual (logical) address space is broken down into multiple pages Example: 4KB pages Virtual Address 10 10 12 baseà frame No 12 Physical Address

Translation Lookaside Buffer Exploit locality to reduce address translation time Keep the translation in a buffer for future references Virtual Address Virtual No offset frame No offset Physical Address Physical Memory Frame 0 Frame 1 Frame 2 Table Frame N-1

Translation Lookaside Buffer Exploit locality to reduce address translation time Keep the translation in a buffer for future references Virtual Address Virtual No offset 0 1 0 1 frame No TLB offset Physical Address Physical Memory Frame 0 Frame 1 Frame 2 Table Frame N-1

Translation Lookaside Buffer Just like any other cache, the TLB can be organized as fully associative, set associative, or direct TLB access is typically faster than cache access Because TLBs are much smaller than caches TLBs are typically not more than 128 to 256 entries even on high-end machines V Virtual # Physical # Dirty Status

CAM Based TLB Content addressable memory (CAM) Unlike RAM, data in address out RAM: Read Operation Address in CAM: Search Operation Data in Decoder address match Data out

CAM Based TLB Content addressable memory (CAM) Unlike RAM, data in address out CAM based TLB Both CAM and RAM are used What if multiple rows match? Virtual No RAM CAM Physical No Dirty Status

TLB in Memory Hierarchy On a TLB miss, is the page loaded in memory? Yes: takes 10 s cycles to update the TLB No: page fault n Takes 1,000,000 s cycles to load the page and update TLB Processor Core VA TLB Lookup hit PA Cache miss Main Memory hit Data

TLB in Memory Hierarchy On a TLB miss, is the page loaded in memory? Yes: takes 10 s cycles to update the TLB No: page fault n Takes 1,000,000 s cycles to load the page and update TLB Processor Core VA TLB Lookup hit PA Cache miss Main Memory miss hit Translaltion Data

TLB in Memory Hierarchy On a TLB miss, is the page loaded in memory? Yes: takes 10 s cycles to update the TLB No: page fault n Takes 1,000,000 s cycles to load the page and update TLB Physically indexed, physically tagged: TLB on critical path! Processor Core VA TLB Lookup hit PA Cache miss Main Memory miss hit Translaltion Data

Physically Indexed Caches Problem: increased critical path due to sequential access to TLB and cache Virtual No Offset TLB Physical Frame Offset

Physically Indexed Caches Problem: increased critical path due to sequential access to TLB and cache Virtual No Offset TLB Physical Frame Offset Tag Index Byte Tag Array Data Array = Data Block hit/miss*

Physically Indexed Caches Problem: increased critical path due to sequential access to TLB and cache Virtual No TLB Physical Frame Offset Offset Observation: lower address bits (page offset) are not translated Tag Index Byte Tag Array Data Array = Data Block hit/miss*

Virtually Indexed Caches Idea: Index into cache in parallel with page number translation in TLB Virtual No Offset TLB Index Byte Tag Tag Array Data Array = Data Block hit/miss*

Virtually Indexed Caches Idea: Index into cache in parallel with page number translation in TLB Virtual No TLB Offset Index Byte what if the page offset is not equal to index+byte? Tag Tag Array Data Array = Data Block hit/miss*