Direct Mapped Cache Hardware. Direct Mapped Cache. Direct Mapped Cache Performance. Direct Mapped Cache Performance. Miss Rate = 3/15 = 20%

Similar documents

Chapter 8 :: Topics. Chapter 8 :: Memory Systems. Introduction Memory System Performance Analysis Caches Virtual Memory Memory-Mapped I/O Summary

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

Digital Logic & Computer Design CS Professor Dan Moldovan Spring Copyright 2007 Elsevier 8-<1>

EN1640: Design of Computing Systems Topic 06: Memory System

Chapter 3. SEQUENTIAL Logic Design. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris.

Chapter 8. Chapter 8:: Topics. Introduction. Processor Memory Gap

Chapter 8. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 8 <1>

EN1640: Design of Computing Systems Topic 06: Memory System

Chapter 8 Virtual Memory

Fundamentals of Computer Systems

Fundamentals of Computer Systems

Chapter 8 Memory Hierarchy and Cache Memory

Basic Memory Hierarchy Principles. Appendix C (Not all will be covered by the lecture; studying the textbook is recommended!)

CSEE 3827: Fundamentals of Computer Systems, Spring Caches

EN2910A: Advanced Computer Architecture Topic 02: Review of classical concepts

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

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

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

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

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

ECE 2300 Digital Logic & Computer Organization. Caches

14:332:331. Week 13 Basics of Cache

V. Primary & Secondary Memory!

Virtual Memory - Objectives

Memory Hierarchy. Mehran Rezaei

ELEC3441: Computer Architecture Second Semester, Homework 3 (r1.1) SOLUTION. r1.1 Page 1 of 12

LECTURE 10: Improving Memory Access: Direct and Spatial caches

Chapter 7: Large and Fast: Exploiting Memory Hierarchy

Locality. CS429: Computer Organization and Architecture. Locality Example 2. Locality Example

LECTURE 12. Virtual Memory

Module 1: Basics and Background Lecture 4: Memory and Disk Accesses. The Lecture Contains: Memory organisation. Memory hierarchy. Disks.

Winter 2009 FINAL EXAMINATION Location: Engineering A Block, Room 201 Saturday, April 25 noon to 3:00pm

Lecture 12: Memory hierarchy & caches

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

Computer Architecture CS372 Exam 3

Memory Hierarchy and Caches

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

Virtual Memory. CS 3410 Computer System Organization & Programming

Review : Pipelining. Memory Hierarchy

ECE232: Hardware Organization and Design

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

Donn Morrison Department of Computer Science. TDT4255 Memory hierarchies

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy

Chapter 5. Memory Technology

Caches. Han Wang CS 3410, Spring 2012 Computer Science Cornell University. See P&H 5.1, 5.2 (except writes)

CSE 141 Spring 2016 Homework 5 PID: Name: 1. Consider the following matrix transpose code int i, j,k; double *A, *B, *C; A = (double

Chapter 6 Caches. Computer System. Alpha Chip Photo. Topics. Memory Hierarchy Locality of Reference SRAM Caches Direct Mapped Associative

Virtual Memory: From Address Translation to Demand Paging

Locality. Cache. Direct Mapped Cache. Direct Mapped Cache

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

and data combined) is equal to 7% of the number of instructions. Miss Rate with Second- Level Cache, Direct- Mapped Speed

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

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

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

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

Memory Hierarchies &

Virtual Memory Nov 9, 2009"

The Memory System. Components of the Memory System. Problems with the Memory System. A Solution

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

Algorithm Performance Factors. Memory Performance of Algorithms. Processor-Memory Performance Gap. Moore s Law. Program Model of Memory I

Contents. Memory System Overview Cache Memory. Internal Memory. Virtual Memory. Memory Hierarchy. Registers In CPU Internal or Main memory

The Memory Hierarchy. Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab M.I.T.

Changelog. Virtual Memory (2) exercise: 64-bit system. exercise: 64-bit system

Handout 4 Memory Hierarchy

The University of Alabama in Huntsville Electrical & Computer Engineering Department CPE Test II November 14, 2000

CMSC411 Fall 2013 Midterm 1

CS3350B Computer Architecture

EE 4683/5683: COMPUTER ARCHITECTURE

UCB CS61C : Machine Structures

The Memory Hierarchy. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 3, 2018 L13-1

LECTURE 11. Memory Hierarchy

CSE Computer Architecture I Fall 2011 Homework 07 Memory Hierarchies Assigned: November 8, 2011, Due: November 22, 2011, Total Points: 100

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

Memory Hierarchy, Fully Associative Caches. Instructor: Nick Riasanovsky

COMP 3221: Microprocessors and Embedded Systems

Administrivia. Expect new HW out today (functions in assembly!)

Review: Computer Organization

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

Computer Architecture Memory hierarchies and caches

Computer Architecture Review. Jo, Heeseung

Computer Science 432/563 Operating Systems The College of Saint Rose Spring Topic Notes: Memory Hierarchy

ECE 4750 Computer Architecture, Fall 2017 T03 Fundamental Memory Concepts

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

Computer Architecture and System Software Lecture 09: Memory Hierarchy. Instructor: Rob Bergen Applied Computer Science University of Winnipeg

CS61C : Machine Structures

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

ECE550 PRACTICE Final

Memory Hierarchy Y. K. Malaiya

14:332:331. Week 13 Basics of Cache

Virtual Memory. Adapted from instructor s supplementary material from Computer. Patterson & Hennessy, 2008, MK]

CS 61C: Great Ideas in Computer Architecture. The Memory Hierarchy, Fully Associative Caches

Chapter 5A. Large and Fast: Exploiting Memory Hierarchy

6.004 Tutorial Problems L20 Virtual Memory

Virtual Memory. Motivation:

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

Components of the Virtual Memory System

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

Lec 13: Linking and Memory. Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University. Announcements

Virtual Memory (2) 1

Transcription:

Direct Mapped Cache Direct Mapped Cache Hardware........................ mem[xff...fc] mem[xff...f8] mem[xff...f4] mem[xff...f] mem[xff...ec] mem[xff...e8] mem[xff...e4] mem[xff...e] 27 8-entry x (+27+)-bit SRAM.............................. mem[x...24] mem[x..2] mem[x..c] mem[x...8] mem[x...4] mem[x...] mem[x...c] mem[x...8] mem[x...4] mem[x...] 2 Word Main 2 Word Cache Set Number 7 () 6 () 5 () 4 () () 2 () () () Copyright 27 Elsevier 8-<2> 27 Copyright 27 Elsevier 8-<2> Direct Mapped Cache Performance Direct Mapped Cache Performance... addi $t, $, 5 loop: beq $t, $, done lw $t, x4($) lw $t2, xc($) lw $t, x8($) addi $t, $t, - Miss Rate /5 2% Set 7 () Set 6 () Set 5 () Set 4 () Set () Set 2 () Set () Set ()... addi $t, $, 5 loop: beq $t, $, done lw $t, x4($) lw $t2, xc($) lw $t, x8($) addi $t, $t, -... mem[x...c]... mem[x...8]... mem[x...4] Miss Rate /5 2% Set 7 () Set 6 () Set 5 () Set 4 () Set () Set 2 () Set () Set () Copyright 27 Elsevier 8-<22> Copyright 27 Elsevier 8-<2>

Direct Mapped Cache: Conflict Direct Mapped Cache: Conflict... addi $t, $, 5 loop: beq $t, $, done lw $t, x4($) lw $t2, x24($) addi $t, $t, - Set 7 () Set 6 () Set 5 () Set 4 () Set () Set 2 () Set () Set ()... addi $t, $, 5 loop: beq $t, $, done lw $t, x4($) lw $t2, x24($) addi $t, $t, -... mem[x...4] Miss Rate % Set 7 () Set 6 () Set 5 () Set 4 () Set () Set 2 () Set () Set () Copyright 27 Elsevier 8-<24> Copyright 27 Elsevier 8-<25> N-Way Set Associative Cache N-Way Set Associative Performance Way Way 28 2 28 28 addi $t, $, 5 loop: beq $t, $, done lw $t, x4($) lw $t2, x24($) addi $t, $t, - Way Way Copyright 27 Elsevier 8-<26> Copyright 27 Elsevier 8-<27> 2

N-way Set Associative Performance Fully Associative Cache addi $t, $, 5 loop: beq $t, $, done lw $t, x4($) lw $t2, x24($) addi $t, $t, - Way Way Miss Rate 2/ 2%... mem[x...24]... mem[x...4] Set Set 2 Set Set Copyright 27 Elsevier 8-<28> Copyright 27 Elsevier 8-<29> Spatial Locality? Cache with Larger Block Size Increase block size: Block size, b 4 words C 8 words Direct mapped ( block per set) Number of blocks, B C/b 8/4 2 Block Offset 27 2 27 Set Set Block Offset 27 2 27 Set Set Copyright 27 Elsevier 8-<> Copyright 27 Elsevier 8-<>

Direct Mapped Cache Performance Direct Mapped Cache Performance loop: addi $t, $, 5 beq $t, $, done lw $t, x4($) lw $t2, xc($) lw $t, x8($) addi $t, $t, - Block Offset 27 2 27 loop: addi $t, $, 5 beq $t, $, done lw $t, x4($) lw $t2, xc($) lw $t, x8($) addi $t, $t, - Block Offset... 27 2... mem[x...c] 27 Miss Rate /5 6.67% mem[x...8] mem[x...4] mem[x...] Set Set Copyright 27 Elsevier 8-<> Copyright 27 Elsevier 8-<> Cache Organization Recap Capacity: C (in bytes) Block size: b (in bytes) Number of blocks in a set: N LRU Replacement # MIPS assembly lw $t, x4($) lw $t, x24($) lw $t2, x54($) Organization Direct Mapped Number of Ways (N) Number of Sets (S) B (a) U Set Number () 2 () () () N-Way Set Associative Fully Associative < N < B B B / N (b) U Set Number () 2 () () () Copyright 27 Elsevier 8-<4> Copyright 27 Elsevier 8-<6> 4

LRU Replacement Intel Pentium III Die # MIPS assembly lw $t, x4($) lw $t, x24($) lw $t2, x54($) Way Way (a) U... mem[x...24]... mem[x...4] Way Way Set () Set 2 () Set () Set () (b) U... mem[x...24]... mem[x...54] Set () Set 2 () Set () Set () Copyright 27 Elsevier 8-<7> Copyright 27 Elsevier 8-<9> The Hierarchy The Hard Disk Technology cost / GB Access time Speed Cache Main SRAM ~ $, ~ ns DRAM ~ $ ~ ns Magnetic Disks Capacity Hard Disk ~ $ ~,, ns Read/Write Head : DRAM : Hard disk Slow, Large, Cheap Copyright 27 Elsevier 8-<4> Takes milliseconds to seek correct location on disk Copyright 27 Elsevier 8-<4> 5

and es Translation Most accesses hit in physical memory, but benefit of large capacity of virtual memory Copyright 27 Elsevier 8-<44> Copyright 27 Elsevier 8-<46> Example 9-bit virtual page numbers 5-bit physical page numbers Example What is the physical address of virtual address x2? Copyright 27 Elsevier 8-<48> Copyright 27 Elsevier 8-<49> 6

Example Example What is the physical address of virtual address x2? PN x2 PN x2 maps to PPN x7fff The lower 2 bits (page offset) is the same for virtual and physical addresses (x) address x7fff Copyright 27 Elsevier 8-<5> PN is index into page table Page Number x2 9 Page Offset Page Number x x7ffe x x7fff x7fff Copyright 27 Elsevier 8-<52> 2 5 2 Translation Example Copyright 27 Elsevier 8-<5> What is the physical address of virtual address x5f2? Page Number x x7ffe x x7fff Copyright 27 Elsevier 8-<54> 5 7

Example Example 2 What is the physical address of virtual address x5f2? PN 5 Entry 5 in page table indicates PN 5 is in physical page address is xf2 Page Number x2 9 Page Offset Page Number x x7ffe x x7fff Copyright 27 Elsevier 8-<55> 2 x7fff 5 2 What is the physical address of virtual address x7e? Page Number x x7ffe x x7fff 5 Copyright 27 Elsevier 8-<56> Example 2 Example Two-Entry TLB What is the physical address of virtual address x7e? PN 7 Entry 7 in page table is invalid, so the page is not in physical memory The virtual page must be swapped into physical memory from disk Page Number x7 Page Offset E Page Number x x7ffe x x7fff Copyright 27 Elsevier 8-<57> 9 5 Page Number x2 9 Page Offset Page Number Page Number Page Number Page Number x7fffd x x2 x7fff TLB 2 Entry 9 5 9 5 Copyright 27 Elsevier 8-<6> 5 x7fff Entry 2 8

Protection Multiple programs (processes) run at once Each process has its own page table Each process can use entire virtual address space without worrying about where other programs are A process can only access physical pages mapped in its page table can t overwrite memory from another process Summary memory increases capacity A subset of virtual pages are located in physical memory A page table maps virtual pages to physical pages this is called address translation A TLB speeds up address translation Copyright 27 Elsevier 8-<62> Copyright 27 Elsevier 8-<6> 9