11/2/2004Comp 120 Fall 20041 2 November 9 classes to go! VOTE! 2 more needed for study. Assignment 10! Cache.

Slides:



Advertisements
Similar presentations
Computer System Organization Computer-system operation – One or more CPUs, device controllers connect through common bus providing access to shared memory.
Advertisements

Performance of Cache Memory
11/8/2005Comp 120 Fall November 9 classes to go! Read Section 7.5 especially important!
1 Lecture 20: Cache Hierarchies, Virtual Memory Today’s topics:  Cache hierarchies  Virtual memory Reminder:  Assignment 8 will be posted soon (due.
Spring 2003CSE P5481 Introduction Why memory subsystem design is important CPU speeds increase 55% per year DRAM speeds increase 3% per year rate of increase.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
1 Lecture 20 – Caching and Virtual Memory  2004 Morgan Kaufmann Publishers Lecture 20 Caches and Virtual Memory.
L19 – Memory Hierarchy 1 Comp 411 – Spring /8/2008 Memory Hierarchy Memory Flavors Principle of Locality Program Traces Memory Hierarchies Associativity.
1  1998 Morgan Kaufmann Publishers Chapter Seven Large and Fast: Exploiting Memory Hierarchy.
1 Chapter Seven Large and Fast: Exploiting Memory Hierarchy.
1 COMP 206: Computer Architecture and Implementation Montek Singh Mon, Oct 31, 2005 Topic: Memory Hierarchy Design (HP3 Ch. 5) (Caches, Main Memory and.
COMP3221: Microprocessors and Embedded Systems Lecture 26: Cache - II Lecturer: Hui Wu Session 2, 2005 Modified from.
Computer ArchitectureFall 2007 © November 12th, 2007 Majd F. Sakr CS-447– Computer Architecture.
1  1998 Morgan Kaufmann Publishers Chapter Seven Large and Fast: Exploiting Memory Hierarchy.
11/3/2005Comp 120 Fall November 10 classes to go! Cache.
EENG449b/Savvides Lec /13/04 April 13, 2004 Prof. Andreas Savvides Spring EENG 449bG/CPSC 439bG Computer.
COMP3221 lec34-Cache-II.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 34: Cache Memory - II
L18 – Memory Hierarchy 1 Comp 411 – Fall /30/2009 Memory Hierarchy Memory Flavors Principle of Locality Program Traces Memory Hierarchies Associativity.
1 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4 to 6 transistors) DRAM: –value is stored as a charge.
CS 524 (Wi 2003/04) - Asim LUMS 1 Cache Basics Adapted from a presentation by Beth Richardson
1 CSE SUNY New Paltz Chapter Seven Exploiting Memory Hierarchy.
Computer ArchitectureFall 2007 © November 12th, 2007 Majd F. Sakr CS-447– Computer Architecture.
Caches – basic idea Small, fast memory Stores frequently-accessed blocks of memory. When it fills up, discard some blocks and replace them with others.
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Chapter 6: Memory Memory is organized into a hierarchy
Lecture 19: Virtual Memory
Lecture 10 Memory Hierarchy and Cache Design Computer Architecture COE 501.
How to Build a CPU Cache COMP25212 – Lecture 2. Learning Objectives To understand: –how cache is logically structured –how cache operates CPU reads CPU.
10/18: Lecture topics Memory Hierarchy –Why it works: Locality –Levels in the hierarchy Cache access –Mapping strategies Cache performance Replacement.
Computer Organization and Design Memory Hierachy Montek Singh Wed, April 27, 2011 Lecture 17.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 10 Memory Hierarchy.
3-May-2006cse cache © DW Johnson and University of Washington1 Cache Memory CSE 410, Spring 2006 Computer Systems
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
The Goal: illusion of large, fast, cheap memory Fact: Large memories are slow, fast memories are small How do we create a memory that is large, cheap and.
CSE378 Intro to caches1 Memory Hierarchy Memory: hierarchy of components of various speeds and capacities Hierarchy driven by cost and performance In early.
Computer Organization and Design Memory Hierarchy Montek Singh Nov 30, 2015 Lecture 15.
1 Chapter Seven. 2 Users want large and fast memories! SRAM access times are ns at cost of $100 to $250 per Mbyte. DRAM access times are ns.
COMP SYSTEM ARCHITECTURE HOW TO BUILD A CACHE Antoniu Pop COMP25212 – Lecture 2Jan/Feb 2015.
DECStation 3100 Block Instruction Data Effective Program Size Miss Rate Miss Rate Miss Rate 1 6.1% 2.1% 5.4% 4 2.0% 1.7% 1.9% 1 1.2% 1.3% 1.2% 4 0.3%
Review °We would like to have the capacity of disk at the speed of the processor: unfortunately this is not feasible. °So we create a memory hierarchy:
1 Chapter Seven CACHE MEMORY AND VIRTUAL MEMORY. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4.
1 Chapter Seven. 2 Users want large and fast memories! SRAM access times are ns at cost of $100 to $250 per Mbyte. DRAM access times are ns.
1  1998 Morgan Kaufmann Publishers Chapter Seven.
Memory Hierarchies Sonish Shrestha October 3, 2013.
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)
The Memory Hierarchy (Lectures #17 - #20) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
1 Chapter Seven. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4 to 6 transistors) DRAM: –value.
3/1/2002CSE Virtual Memory Virtual Memory CPU On-chip cache Off-chip cache DRAM memory Disk memory Note: Some of the material in this lecture are.
CMSC 611: Advanced Computer Architecture
Address – 32 bits WRITE Write Cache Write Main Byte Offset Tag Index Valid Tag Data 16K entries 16.
Cache Memory and Performance
The Goal: illusion of large, fast, cheap memory
Computer Organization and Design Memory Hierarchy and Caches
Morgan Kaufmann Publishers Memory & Cache
Computer Organization and Design Memory Hierarchy
ECE 445 – Computer Organization
Chapter 8 Digital Design and Computer Architecture: ARM® Edition
Lecture 23: Cache, Memory, Virtual Memory
Computer Organization and Design Memory Hierarchy
November 14 6 classes to go! Read
Lecture 22: Cache Hierarchies, Memory
Memory Hierarchy Memory Flavors Principle of Locality Program Traces
Morgan Kaufmann Publishers Memory Hierarchy: Cache Basics
Memory Hierarchy Memory: hierarchy of components of various speeds and capacities Hierarchy driven by cost and performance In early days Primary memory.
Chapter Five Large and Fast: Exploiting Memory Hierarchy
Memory Hierarchy and Caches
Memory Principles.
Overview Problem Solution CPU vs Memory performance imbalance
Presentation transcript:

11/2/2004Comp 120 Fall November 9 classes to go! VOTE! 2 more needed for study. Assignment 10! Cache

11/2/2004Comp 120 Fall Memory Hierarchy CPU cycle 400ps Cache time 400ps DRAM ns Disk 10ms Let’s translate these into human scale times: CPU cycle 1 second DRAM access 2 minutes Disk access 10 months!

11/2/2004Comp 120 Fall Cache cache (kash) n. 1.A hiding place used especially for storing provisions. 2.A place for concealment and safekeeping, as of valuables. 3.The store of goods or valuables concealed in a hiding place. 4.Computer Science. A fast storage buffer in the central processing unit of a computer. In this sense, also called cache memory. v. tr. cached, cach·ing, cach·es. 1.To hide or store in a cache.

11/2/2004Comp 120 Fall Cache Analogy You are writing a term paper at a table in the library As you work you realize you need a book You stop writing, fetch the reference, continue writing You don’t immediately return the book, maybe you’ll need it again Soon you have a few books at your table and no longer have to fetch more books The table is a CACHE for the rest of the library

11/2/2004Comp 120 Fall Cache Sits between CPU and main memory Very fast table that stores a TAG and DATA –TAG is the memory address –DATA is a copy of memory at the address given by TAG Memory TagData

11/2/2004Comp 120 Fall Cache Access On load we look in the TAG entries for the address we’re loading –Found  a HIT, return the DATA –Not Found  a MISS, go to memory for the data and put it and the address (TAG) in the cache Memory TagData

11/2/2004Comp 120 Fall Cache Lines Usually get more data than requested (Why?) –a LINE is the unit of memory stored in the cache –usually much bigger than 1 word, 32 bytes per line is common –bigger LINE means fewer misses because of spatial locality –but bigger LINE means longer time on miss TagData Memory

11/2/2004Comp 120 Fall Finding the TAG in the Cache A 1MByte cache may have 32k different lines each of 32 bytes We can’t afford to sequentially search the 32k different tags ASSOCIATIVE memory uses hardware to compare the address to the tags in parallel but it is expensive and 1MByte is thus unlikely DIRECT MAPPED CACHE computes the cache entry from the address –multiple addresses map to the same cache line –use TAG to determine if right Choose some bits from the address to determine the Cache line –low 5 bits determine which byte within the line –we need 15 bits to determine which of the 32k different lines has the data –which of the 32 – 5 = 27 remaining bits should we use?

11/2/2004Comp 120 Fall Direct-Mapping Example TagData Memory With 8 byte lines, the bottom 3 bits determine the byte within the line With 4 cache lines, the next 2 bits determine which line to use 1024d = b  line = 00b = 0d 1000d = b  line = 01b = 1d 1040d = b  line = 10b = 2d

11/2/2004Comp 120 Fall Direct Mapping Miss TagData Memory What happens when we now ask for address 1008? 1008d = b  line = 10b = 2d but earlier we put 1040d there d = b  line = 10b = 2d

11/2/2004Comp 120 Fall Miss Penalty and Rate The MISS PENALTY is the time it takes to read the memory if it isn’t in the cache –50 to 100 cycles is common. The MISS RATE is the fraction of accesses which MISS The HIT RATE is the fraction of accesses which HIT MISS RATE + HIT RATE = 1 Suppose a particular cache has a MISS PENALTY of 100 cycles and a HIT RATE of 95%. The CPI for load on HIT is 5 but on a MISS it is 105. What is the average CPI for load? Average CPI = 10 Suppose MISS PENALTY = 120 cycles? then CPI = 11 (slower memory doesn’t hurt much) 5 * * 0.05 = 10

11/2/2004Comp 120 Fall Some Associativity can help Direct-Mapped caches are very common but can cause problems... SET ASSOCIATIVITY can help. Multiple Direct-mapped caches, then compare multiple TAGS –2-way set associative = 2 direct mapped + 2 TAG comparisons –4-way set associative = 4 direct mapped + 4 TAG comparisons Now array size == power of 2 doesn’t get us in trouble But –slower –less memory in same area –maybe direct mapped wins...

11/2/2004Comp 120 Fall What about store? What happens in the cache on a store? –WRITE BACK CACHE  put it in the cache, write on replacement –WRITE THROUGH CACHE  put in cache and in memory What happens on store and a MISS? –WRITE BACK will fetch the line into cache –WRITE THROUGH might just put it in memory

11/2/2004Comp 120 Fall