CS 61C L20 Caches I (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.

Slides:



Advertisements
Similar presentations
CS 61C L13Introduction to MIPS: Instruction Representation I (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
Advertisements

CS 430 – Computer Architecture
Modified from notes by Saeid Nooshabadi COMP3221: Microprocessors and Embedded Systems Lecture 25: Cache - I Lecturer:
CS 61C L13 Combinational Logic (1) A Carle, Summer 2005 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #13: Combinational.
CS61C L31 Caches II (1) Garcia, Fall 2006 © UCB GPUs >> CPUs?  Many are using graphics processing units on graphics cards for high-performance computing.
Memory Subsystem and Cache Adapted from lectures notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley.
Lecturer PSOE Dan Garcia
CS61C L23 Cache II (1) Chae, Summer 2008 © UCB Albert Chae, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #23 – Cache II.
CS61C L24 Introduction to CPU Design (1) Garcia, Spring 2007 © UCB Cell pic to web site  A new MS app lets people search the web based on a digital cell.
CS61C L20 Synchronous Digital Systems (1) Garcia, Spring 2010 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
COMP3221 lec33-Cache-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 12: Cache Memory - I
CS61C L20 Synchronous Digital Systems (1) Garcia, Fall 2006 © UCB Blu-ray vs HD-DVD war over?  As you know, there are two different, competing formats.
CS61C L23 Caches I (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #23 Cache I.
Computer ArchitectureFall 2008 © October 27th, 2008 Majd F. Sakr CS-447– Computer Architecture.
CS61C L21 Caches I (1) Garcia, Fall 2005 © UCB Lecturer PSOE, new dad Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
1 Chapter Seven Large and Fast: Exploiting Memory Hierarchy.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 31 – Caches II In this week’s Science, IBM researchers describe a new class.
CS61C L33 Caches III (1) Garcia, Spring 2007 © UCB Future of movies is 3D?  Dreamworks says they may exclusively release movies in this format. It’s based.
COMP3221: Microprocessors and Embedded Systems Lecture 26: Cache - II Lecturer: Hui Wu Session 2, 2005 Modified from.
CS61C L32 Caches II (1) Garcia, 2005 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
CS61C L18 Introduction to CPU Design (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
CS61C L31 Caches I (1) Garcia 2005 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
CS 61C L35 Caches IV / VM I (1) Garcia, Fall 2004 © UCB Andy Carle inst.eecs.berkeley.edu/~cs61c-ta inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
CS61C L14 Introduction to Synchronous Digital Systems (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS61C L20 Caches I (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #20: Caches Andy Carle.
CS61C L32 Caches II (1) Garcia, Spring 2007 © UCB Experts weigh in on Quantum CPU  Most “profoundly skeptical” of the demo. D-Wave has provided almost.
CS61C L30 Caches I (1) Garcia, Fall 2006 © UCB Shuttle can’t fly over Jan 1?  A computer bug has come up for the shuttle – its computers don’t reset to.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 30 – Caches I Touted as “the fastest CPU on Earth”, IBM’s new Power6 doubles.
Computer ArchitectureFall 2007 © November 12th, 2007 Majd F. Sakr CS-447– Computer Architecture.
Computer ArchitectureFall 2007 © November 7th, 2007 Majd F. Sakr CS-447– Computer Architecture.
COMP3221 lec34-Cache-II.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 34: Cache Memory - II
CS61C L24 Introduction to CPU Design (1) Garcia, Fall 2006 © UCB Fedora Core 6 (FC6) just out  The latest version of the distro has been released; they.
Cs 61C L17 Cache.1 Patterson Spring 99 ©UCB CS61C Cache Memory Lecture 17 March 31, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson) www-inst.eecs.berkeley.edu/~cs61c/schedule.html.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 24 Introduction to CPU design Stanford researchers developing 3D camera.
CS 61C L20 Introduction to Synchronous Digital Systems (1) Garcia, Fall 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS61C L31 Caches I (1) Garcia, Spring 2007 © UCB Powerpoint bad!!  Research done at the Univ of NSW says that “working memory”, the brain part providing.
CS61C L20 Synchronous Digital Systems (1) Garcia, Spring 2007 © UCB Disk failures 15x specs!  A recent conference reveals that drives fail in real life.
CS61C L20 Introduction to Synchronous Digital Systems (1) Garcia © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS 61C L21 Caches II (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS 61C L30 Introduction to Pipelined Execution (1) Garcia, Fall 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS 61C L23 Caches IV / VM I (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C :
CS61C L14 Introduction to Synchronous Digital Systems (1) Garcia, Fall 2005 © UCB Lecturer PSOE, new dad Dan Garcia inst.eecs.berkeley.edu/~cs61c.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 14 Instructor: L.N. Bhuyan
Computer ArchitectureFall 2007 © November 12th, 2007 Majd F. Sakr CS-447– Computer Architecture.
DAP Spr.‘98 ©UCB 1 Lecture 11: Memory Hierarchy—Ways to Reduce Misses.
Cache Memory CSE Slides from Dan Garcia, UCB.
CS1104: Computer Organisation School of Computing National University of Singapore.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 10 Memory Hierarchy.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
CS61C L17 Cache1 © UC Regents 1 CS61C - Machine Structures Lecture 17 - Caches, Part I October 25, 2000 David Patterson
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
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.
Csci 211 Computer System Architecture – Review on Cache Memory Xiuzhen Cheng
1 chapter 1 Computer Architecture and Design ECE4480/5480 Computer Architecture and Design Department of Electrical and Computer Engineering University.
ECE 15B Computer Organization Spring 2011 Dmitri Strukov Partially adapted from Computer Organization and Design, 4 th edition, Patterson and Hennessy,
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.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 30 – Caches I After more than 4 years C is back at position number 1 in.
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.
CS 61C L4.1.1 Combinational Logic (1) K. Meinz, Summer 2004 © UCB CS61C : Machine Structures Lecture Logic Gates and Combinational Logic
CS61C L20 Synchronous Digital Systems (1) Beamer, Spring 2008 © UCB Scott Beamer, Guest Lecturer inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
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.
Instructor Paul Pearce
Memristor memory on its way (hopefully)
CS-447– Computer Architecture Lecture 20 Cache Memories
Lecturer PSOE Dan Garcia
Some of the slides are adopted from David Patterson (UCB)
Some of the slides are adopted from David Patterson (UCB)
Lecturer PSOE Dan Garcia
Presentation transcript:

CS 61C L20 Caches I (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 20 – Caches I SIGCSE 2004  Success! inesthetic earning ctivities Mob Topo-Sort!

CS 61C L20 Caches I (2) Garcia, Spring 2004 © UCB Review C program: foo.c Assembly program: foo.s Executable(mach lang pgm): a.out Compiler Assembler Linker Loader Memory Object(mach lang module): foo.o lib.o

CS 61C L20 Caches I (3) Garcia, Spring 2004 © UCB 61C What are “Machine Structures”? Coordination of many levels of abstraction I/O systemProcessor Compiler Operating System (MacOS X) Application (Netscape) Digital Design Circuit Design Instruction Set Architecture Datapath & Control transistors Memory Hardware Software Assembler

CS 61C L20 Caches I (4) Garcia, Spring 2004 © UCB Below the Program High-level language program (in C) swap int v[], int k){ int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } Assembly language program (for MIPS) swap: sll$2, $5, 2 add$2, $4,$2 lw$15, 0($2) lw$16, 4($2) sw$16, 0($2) sw$15, 4($2) jr$31 Machine (object) code (for MIPS) C compilerassembler

CS 61C L20 Caches I (5) Garcia, Spring 2004 © UCB Design Principles for Hardware 1. Simplicity favors regularity Every instruction has 3 operands, opcode same place for EVERY instr 2. Smaller is faster 32 registers, no more 3. Good design demands good compromise MIPS Immediate format vs. R format 4. Make the common case fast Support of constants via immediates

CS 61C L20 Caches I (6) Garcia, Spring 2004 © UCB Computer Technology - Dramatic Change! Memory DRAM capacity: 2x / 2 years (since ‘96); 64x size improvement in last decade. Processor Speed 2x / 1.5 years (since ‘85); 100X performance in last decade. Disk Capacity: 2x / 1 year (since ‘97) 250X size in last decade.

CS 61C L20 Caches I (7) Garcia, Spring 2004 © UCB Big Ideas so far 15 weeks to learn big ideas in CS&E Principle of abstraction, used to build systems as layers Pliable Data: a program determines what it is Stored program concept: instructions just data Compilation v. interpretation to move down layers of system Principle of Locality, exploited via a memory hierarchy (cache) Greater performance by exploiting parallelism (pipeline) Principles/Pitfalls of Performance Measurement

CS 61C L20 Caches I (8) Garcia, Spring 2004 © UCB What does your 61C future hold? We’ve reached the half-way mark. It’s time to shift gears a bit, but to what? Architecture! (aka “Systems”) Caches Virtual Memory CPU Organization Pipelining I / O Networks Performance

CS 61C L20 Caches I (9) Garcia, Spring 2004 © UCB The Big Picture Processor (active) Computer Control (“brain”) Datapath (“brawn”) Memory (passive) (where programs, data live when running) Devices Input Output Keyboard, Mouse Display, Printer Disk, Network

CS 61C L20 Caches I (10) Garcia, Spring 2004 © UCB Memory Hierarchy (1/3) Processor executes instructions on order of nanoseconds to picoseconds holds a small amount of code and data in registers Memory More capacity than registers, still limited Access time ~ ns Disk HUGE capacity (virtually limitless) VERY slow: runs ~milliseconds

CS 61C L20 Caches I (11) Garcia, Spring 2004 © UCB Memory Hierarchy (2/3) Processor Size of memory at each level Increasing Distance from Proc., Decreasing speed Level 1 Level 2 Level n Level 3... Higher Lower Levels in memory hierarchy As we move to deeper levels the latency goes up and price per bit goes down. Q: Can $/bit go up as move deeper?

CS 61C L20 Caches I (12) Garcia, Spring 2004 © UCB Memory Hierarchy (3/3) If level closer to Processor, it must be: smaller faster subset of lower levels (contains most recently used data) Lowest Level (usually disk) contains all available data Other levels?

CS 61C L20 Caches I (13) Garcia, Spring 2004 © UCB Memory Caching We’ve discussed three levels in the hierarchy: processor, memory, disk Mismatch between processor and memory speeds leads us to add a new level: a memory cache Implemented with SRAM technology: faster but more expensive than DRAM memory.

CS 61C L20 Caches I (14) Garcia, Spring 2004 © UCB Memory Hierarchy Analogy: Library (1/2) You’re writing a term paper (Processor) at a table in Doe Doe Library is equivalent to disk essentially limitless capacity very slow to retrieve a book Table is memory smaller capacity: means you must return book when table fills up easier and faster to find a book there once you’ve already retrieved it

CS 61C L20 Caches I (15) Garcia, Spring 2004 © UCB Memory Hierarchy Analogy: Library (2/2) Open books on table are cache smaller capacity: can have very few open books fit on table; again, when table fills up, you must close a book much, much faster to retrieve data Illusion created: whole library open on the tabletop Keep as many recently used books open on table as possible since likely to use again Also keep as many books on table as possible, since faster than going to library

CS 61C L20 Caches I (16) Garcia, Spring 2004 © UCB Memory Hierarchy Basis Disk contains everything. When Processor needs something, bring it into to all higher levels of memory. Cache contains copies of data in memory that are being used. Memory contains copies of data on disk that are being used. Entire idea is based on Temporal Locality: if we use it now, we’ll want to use it again soon (a Big Idea)

CS 61C L20 Caches I (17) Garcia, Spring 2004 © UCB Cache Design How do we organize cache? Where does each memory address map to? (Remember that cache is subset of memory, so multiple memory addresses map to the same cache location.) How do we know which elements are in cache? How do we quickly locate them?

CS 61C L20 Caches I (18) Garcia, Spring 2004 © UCB Direct-Mapped Cache (1/2) In a direct-mapped cache, each memory address is associated with one possible block within the cache Therefore, we only need to look in a single location in the cache for the data if it exists in the cache Block is the unit of transfer between cache and memory

CS 61C L20 Caches I (19) Garcia, Spring 2004 © UCB Direct-Mapped Cache (2/2) Cache Location 0 can be occupied by data from: Memory location 0, 4, 8,... 4 blocks => any memory location that is multiple of 4 Memory Memory Address A B C D E F 4 Byte Direct Mapped Cache Cache Index

CS 61C L20 Caches I (20) Garcia, Spring 2004 © UCB Issues with Direct-Mapped Since multiple memory addresses map to same cache index, how do we tell which one is in there? What if we have a block size > 1 byte? Result: divide memory address into three fields ttttttttttttttttt iiiiiiiiii oooo tagindexbyte to checkto offset if have selectwithin correct blockblockblock

CS 61C L20 Caches I (21) Garcia, Spring 2004 © UCB Direct-Mapped Cache Terminology All fields are read as unsigned integers. Index: specifies the cache index (which “row” of the cache we should look in) Offset: once we’ve found correct block, specifies which byte within the block we want Tag: the remaining bits after offset and index are determined; these are used to distinguish between all the memory addresses that map to the same location

CS 61C L20 Caches I (22) Garcia, Spring 2004 © UCB Administrivia Midterm exam in 5.5 hours! 155 Dwinelle 9 Questions (many short-answer) 75 points Project 2 All grades entered. Grades frozen (one week to request regrade, same as always).

CS 61C L20 Caches I (23) Garcia, Spring 2004 © UCB Peer Instruction A. Mem hierarchies were invented before (UNIVAC I wasn’t delivered ‘til 1951) B. If you know your computer’s cache size, you can often make your code run faster. C. Memory hierarchies take advantage of spatial locality by keeping the most recent data items closer to the processor. ABC 1: FFF 2: FFT 3: FTF 4: FTT 5: TFF 6: TFT 7: TTF 8: TTT

CS 61C L20 Caches I (24) Garcia, Spring 2004 © UCB Peer Instruction – Midterm… A. I’m ready / not-ready for the exam B. The exam is out of 75. The tens digit of my score will probably be: 7 / 6 / 5 / 4 / ≤ 3 1: READY 7 2: READY 6 3: READY 5 4: READY 4 5: READY ≤3 6: NOT-READY 7 7: NOT-READY 6 8: NOT-READY 5 9: NOT-READY 4 0: NOT-READY ≤3

CS 61C L20 Caches I (25) Garcia, Spring 2004 © UCB And in conclusion… 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: each successively lower level contains “most used” data from next higher level exploits temporal locality do the common case fast, worry less about the exceptions (design principle of MIPS) Locality of reference is a Big Idea