Translation Lookaside Buffers

Slides:



Advertisements
Similar presentations
Page Table Implementation
Advertisements

Virtual Memory In this lecture, slides from lecture 16 from the course Computer Architecture ECE 201 by Professor Mike Schulte are used with permission.
EECS 470 Virtual Memory Lecture 15. Why Use Virtual Memory? Decouples size of physical memory from programmer visible virtual memory Provides a convenient.
Chapter 19 Translation Lookaside Buffer Chien-Chung Shen CIS, UD
Computer Organization CS224 Fall 2012 Lesson 44. Virtual Memory  Use main memory as a “cache” for secondary (disk) storage l Managed jointly by CPU hardware.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Virtual Memory 2 P & H Chapter
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Principle Behind Hierarchical Storage  Each level memorizes values stored at lower levels  Instead of paying the full latency for the “furthermost” level.
Translation Buffers (TLB’s)
1 Tuesday, July 04, 2006 "Programs expand to fill the memory available to hold them." - Modified Parkinson’s Law.
CS 241 Section Week #12 (04/22/10).
Operating Systems Lecture 11 MIPS TLB Structure Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
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.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
CS399 New Beginnings Jonathan Walpole. Virtual Memory (1)
Virtual Memory Part 1 Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology May 2, 2012L22-1
1 Memory Management. 2 Fixed Partitions Legend Free Space 0k 4k 16k 64k 128k Internal fragmentation (cannot be reallocated) Divide memory into n (possible.
Virtual Memory Additional Slides Slide Source: Topics Address translation Accelerating translation with TLBs class12.ppt.
Chapter 91 Logical Address in Paging  Page size always chosen as a power of 2.  Example: if 16 bit addresses are used and page size = 1K, we need 10.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
Page Table Implementation. Readings r Silbershatz et al:
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)
Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts.
CS203 – Advanced Computer Architecture Virtual Memory.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
COMP 3500 Introduction to Operating Systems Paging: Basic Method Dr. Xiao Qin Auburn University Slides.
Chapter 19 Translation Lookaside Buffer
CS161 – Design and Architecture of Computer
Memory: Page Table Structure
Translation Lookaside Buffer
Basic Paging (1) logical address space of a process can be made noncontiguous; process is allocated physical memory whenever the latter is available. Divide.
Lecture 11 Virtual Memory
Section 8 Address Translation March 10th, 2017 Taught by Joshua Don.
CS161 – Design and Architecture of Computer
Lecture Topics: 11/19 Paging Page tables Memory protection, validation
Virtual Memory User memory model so far:
From Address Translation to Demand Paging
From Address Translation to Demand Paging
Page Table Implementation
Memory Hierarchy Virtual Memory, Address Translation
Morgan Kaufmann Publishers
CS510 Operating System Foundations
CSE 153 Design of Operating Systems Winter 2018
CSCI206 - Computer Organization & Programming
Virtual Memory 3 Hakim Weatherspoon CS 3410, Spring 2011
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
FIGURE 12-1 Memory Hierarchy
Lecture 33 Syed Mansoor Sarwar
Translation Lookaside Buffer
Virtual Memory.
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
So far in memory management…
Translation Buffers (TLB’s)
TLB Performance Seung Ki Lee.
Virtual Memory Overcoming main memory size limitation
© 2004 Ed Lazowska & Hank Levy
Translation Buffers (TLB’s)
CSC3050 – Computer Architecture
Lecture 8: Efficient Address Translation
Paging Memory Relocation and Fragmentation Paging
CSE 153 Design of Operating Systems Winter 2019
Translation Buffers (TLBs)
CS161 – Design and Architecture of Computer
Review What are the advantages/disadvantages of pages versus segments?
4.3 Virtual Memory.
Presentation transcript:

Translation Lookaside Buffers CSCE 410/611 Translation Lookaside Buffers Page table lookups are expensive! Caching of page table entries Translation Lookaside Buffers (TLBs) Software-managed TLBs: MIPS TLBs

Recall: Address Translation for Two-Level Paging CSCE 410/611 Recall: Address Translation for Two-Level Paging Physical Memory MMU CPU page table nr. page nr. offset PTBR f d f TLBs

Recall: Address Translation for Two-Level Paging CSCE 410/611 Recall: Address Translation for Two-Level Paging Physical Memory MMU CPU page table nr. page nr. offset f d PTBR f TLBs

Solution: Translation Lookaside Buffers CSCE 410/611 Solution: Translation Lookaside Buffers Physical Memory MMU CPU page table nr. page nr. offset f d Translation lookaside buffer (TLB) page nr. frame nr. f PTBR f “input” “output” TLBs

Memory Translation with a TLB CSCE 410/611 Memory Translation with a TLB page nr. frame nr. f Split virtual address, use page number. Look in the TLB to see if we find translation entry for page. If YES, use frame number. If NO, system must locate page entry in main-memory-resident page table, load it into TLB, and start again. TLBs

Parameters of the TLB Parameters of TLBs Size: 12 – 4096 entries CSCE 410/611 Parameters of the TLB page nr. frame nr. f Parameters of TLBs Size: 12 – 4096 entries Lookup latency: 0.5 – 1 clock cycles Miss penalty: 10 – 100 clock cycles Target miss rate: 0.01% – 1% TLBs

Freeing TLB Entries Page Table MMU f CSCE 410/611 TLBs Logical Memory Physical Memory MMU Page Table PTBR frame f page p f TLBs

Freeing TLB Entries p f Page Table MMU f CSCE 410/611 TLBs Logical Memory Physical Memory MMU Page Table PTBR frame f page p f TLB page nr. frame nr. p f TLBs

Freeing TLB Entries ? p f Page Table MMU CSCE 410/611 TLBs Logical Memory Physical Memory MMU Page Table PTBR TLB Flush TLB entry page nr. frame nr. ? p f TLBs

How many TLBs? One TLB per address space (process) CSCE 410/611 How many TLBs? One TLB per address space (process) Need to flush TLB for every process switch. page nr. frame nr. f One TLB for entire system address space id page nr. frame nr. f TLBs

Software-Managed TLBs: Paging - MIPS Style CSCE 410/611 Process no. Program (virtual) address ASID VPN (virtual page number) Address within page System-wide TLB ASID VPN PFN Flags Physical address PFN (physical frame number) Address within frame TLBs

Software-Managed TLBs: Paging - MIPS Style CSCE 410/611 Software-Managed TLBs: Paging - MIPS Style Process no. Program (virtual) address ASID VPN (virtual page number) Address within page TLB refill exception! System-wide TLB no match?! Physical address TLBs

Software-Managed TLBs: Paging - MIPS Style CSCE 410/611 Software-Managed TLBs: Paging - MIPS Style Process no. Program (virtual) address ASID VPN (virtual page number) Address within page TLB refill exception! System-wide TLB Page table (in memory) ASID VPN PFN Flags PFN Flags refill Physical address TLBs

Software-Managed TLBs: Paging - MIPS Style CSCE 410/611 Process no. Program (virtual) address ASID VPN (virtual page number) Address within page System-wide TLB ASID VPN PFN Flags Physical address PFN (physical frame number) Address within frame TLBs

Memory Translation -- MIPS Style CSCE 410/611 Memory Translation -- MIPS Style Principle: Make do with as little hardware as possible. Apart from a register with the ASID, the MMU is just the TLB. The rest is all implemented in software! When TLB cannot translate an address, a special exception (TLB refill) is raised. Software then takes over. Page table (in memory) System-wide TLB VPN ASID PFN Flags refill TLBs

Software managed TLBs: TLB Refill Exception CSCE 410/611 Software managed TLBs: TLB Refill Exception Figure out if this virtual address is valid. If not, trap to handling of address errors. If address is valid, construct TLB entry. If TLB already full, select an entry to discard. Write the new entry into the TLB. Page table (in memory) System-wide TLB VPN ASID PFN Flags refill TLBs

The MIPS TLB: TLB Entry Fields CSCE 410/611 The MIPS TLB: TLB Entry Fields input output VPN ASID G PFN Flags N D V VPN: Virtual page number ASID: identifies the address space G: if set, disables the matching with the ASID PFN: Physical frame number N: cacheable / non-cacheable D: “write-control” bit (set to 1 if writeable) V: valid bit Page table (in memory) System-wide TLB VPN ASID PFN Flags refill TLBs

TLBs: Summary Translation Lookaside Buffers (TLBs) CSCE 410/611 TLBs: Summary Translation Lookaside Buffers (TLBs) Page table lookups are expensive! Caching of page table entries Hardware-managed vs. Software-managed TLBs TLBs on the MIPS TLBs