Lecture 11 Caches

Lecture 11 Caches - CS M151B / EE M116C Computer Systems...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Reinman 11-1 CS M151B / EE M116C Computer Systems Architecture Caches Some notes adopted from Dean Tullsen and Larry Carter at UCSD
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reinman 11-2 The five components Computer Memory Datapath Control Output Input
Background image of page 2
Reinman 11-3 The Problem with Memory • It’s expensive (and perhaps impossible) to build a large, fast memory – “fast” meaning “low latency” • why is low latency important? • To access data quickly: – it must be physically close – there can’t be too many layers of logic • Solution: Move data you are about to access to a nearby, smaller, memory cache – Assuming you can make good guesses about what you will access soon.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reinman 11-4 A Memory Hierarchy CPU SRAM memory SRAM memory DRAM memory Disk memory on-chip “level 1” cache off-chip “level 2” cache main memory disk small, fast big, slower, cheaper/bit huge, very slow, very cheap
Background image of page 4
Reinman 11-5 Cache Basics • In running program, main memory is data’s “home location”. – Addresses refer to location in main memory. – “Virtual memory” allows disk to extend DRAM • We’ll study virtual memory later • When data is accessed, it is automatically moved into cache – Processor (or smaller cache) uses cache’s copy – Data in main memory may (temporarily) get out-of-date • But hardware must keep everything consistent. – Unlike registers, cache is not part of ISA • Different models can have totally different cache design
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reinman 11-6 The Principle of Locality • Memory hierarchies take advantage of memory locality. – The principle that future memory accesses are near past accesses. • Two types of locality: – Temporal locality - near in time: we will often access the same data again very soon – Spatial locality - near in space/distance: our next access is often very close to recent accesses. • This sequence of addresses has both types of locality 1, 2, 3, 1, 2, 3, 8, 8, 47, 9, 10, 8, 8 . ..
Background image of page 6
Reinman 11-7 What is Cached? • Taking advantage of temporal locality: – bring data into cache whenever its referenced – kick out something that hasn’t been used recently • Taking advantage of spatial locality: – bring in a block of contiguous data (cacheline), not just the requested data. • Some processors have instructions that let software influence cache: – Prefetch instruction (“bring location x into cache”) – “Never cache x” or “keep x in cache” instructions
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reinman 11-8 Cache Vocabulary • cache hit: access where data is found in the cache • cache miss: access where data is NOT in the cache • cache block size or cache line size: the amount of data that gets transferred on a cache miss. • instruction cache (I-cache): cache that only holds instructions • data cache (D-cache): cache that only holds data • unified cache: cache that holds both data & instructions A typical processor today has separate “Level 1” I- and D-caches on the same chip as the processor (and possibly a larger, unified “L2” on-chip cache.
Background image of page 8
Reinman 11-9 Cache Issues • On a memory access – How does hardware know if it is a hit or miss?
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 46

Lecture 11 Caches - CS M151B / EE M116C Computer Systems...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online