CSCI206 - Computer Organization & Programming

Slides:



Advertisements
Similar presentations
Lecture 19: Cache Basics Today’s topics: Out-of-order execution
Advertisements

1 Copyright © 2012, Elsevier Inc. All rights reserved. Chapter 2 (and Appendix B) Memory Hierarchy Design Computer Architecture A Quantitative Approach,
The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache.
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.
How caches take advantage of Temporal locality
Modified from notes by Saeid Nooshabadi
Embedded Computer Architecture 5KK73 TU/e Henk Corporaal Bart Mesman Data Memory Management Part d: Data Layout for Caches.
Caches J. Nelson Amaral University of Alberta. Processor-Memory Performance Gap Bauer p. 47.
1  Caches load multiple bytes per block to take advantage of spatial locality  If cache block size = 2 n bytes, conceptually split memory into 2 n -byte.
2/27/2002CSE Cache II Caches, part II CPU On-chip cache Off-chip cache DRAM memory Disk memory.
COEN 180 Main Memory Cache Architectures. Basics Speed difference between cache and memory is small. Therefore:  Cache algorithms need to be implemented.
EECS 370 Discussion 1 xkcd.com. EECS 370 Discussion Topics Today: – Caches!! Theory Design Examples 2.
Lecture Objectives: 1)Define set associative cache and fully associative cache. 2)Compare and contrast the performance of set associative caches, direct.
Lecture 10 Memory Hierarchy and Cache Design Computer Architecture COE 501.
The Memory Hierarchy 21/05/2009Lecture 32_CA&O_Engr Umbreen Sabir.
Multilevel Memory Caches Prof. Sirer CS 316 Cornell University.
10/18: Lecture topics Memory Hierarchy –Why it works: Locality –Levels in the hierarchy Cache access –Mapping strategies Cache performance Replacement.
CSE 378 Cache Performance1 Performance metrics for caches Basic performance metric: hit ratio h h = Number of memory references that hit in the cache /
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 10 Memory Hierarchy.
1  1998 Morgan Kaufmann Publishers Recap: Memory Hierarchy of a Modern Computer System By taking advantage of the principle of locality: –Present the.
Multiprocessor cache coherence. Caching: terms and definitions cache line, line size, cache size degree of associativity –direct-mapped, set and fully.
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:
Cache Small amount of fast memory Sits between normal main memory and CPU May be located on CPU chip or module.
COMP 3221: Microprocessors and Embedded Systems Lectures 27: Cache Memory - III Lecturer: Hui Wu Session 2, 2005 Modified.
Improving Memory Access The Cache and Virtual Memory
CSE 351 Section 9 3/1/12.
Associativity in Caches Lecture 25
Multilevel Memories (Improving performance using alittle “cash”)
Basic Performance Parameters in Computer Architecture:
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
The Hardware/Software Interface CSE351 Winter 2013
Lecture: Cache Hierarchies
CSCI206 - Computer Organization & Programming
Caches III CSE 351 Autumn 2017 Instructor: Justin Hsia
Consider a Direct Mapped Cache with 4 word blocks
Morgan Kaufmann Publishers
Lecture: Cache Hierarchies
CS61C : Machine Structures Lecture 6. 2
Lecture 21: Memory Hierarchy
Lecture 21: Memory Hierarchy
CSCI206 - Computer Organization & Programming
Lecture 23: Cache, Memory, Virtual Memory
Module IV Memory Organization.
Lecture 22: Cache Hierarchies, Memory
CPE 631 Lecture 05: Cache Design
Module IV Memory Organization.
Memory Hierarchy Memory: hierarchy of components of various speeds and capacities Hierarchy driven by cost and performance In early days Primary memory.
Performance metrics for caches
CDA 5155 Caches.
Adapted from slides by Sally McKee Cornell University
Overheads for Computers as Components 2nd ed.
CSE 351: The Hardware/Software Interface
Performance metrics for caches
Morgan Kaufmann Publishers Memory Hierarchy: Cache Basics
CS 704 Advanced Computer Architecture
Caches III CSE 351 Autumn 2018 Instructor: Justin Hsia
Lecture 22: Cache Hierarchies, Memory
CS 3410, Spring 2014 Computer Science Cornell University
Lecture 21: Memory Hierarchy
Memory Hierarchy Memory: hierarchy of components of various speeds and capacities Hierarchy driven by cost and performance In early days Primary memory.
Performance metrics for caches
Cache - Optimization.
Cache Memory Rabi Mahapatra
Cache Memory and Performance
Principle of Locality: Memory Hierarchies
Lecture 13: Cache Basics Topics: terminology, cache organization (Sections )
Performance metrics for caches
10/18: Lecture Topics Using spatial locality
Caches III CSE 351 Spring 2019 Instructor: Ruth Anderson
Overview Problem Solution CPU vs Memory performance imbalance
Presentation transcript:

CSCI206 - Computer Organization & Programming Improved Caches zyBook: 12.4

Cache Write Policy Is the data in the cache? yes no Update the cache and main memory (write through) Update the cache only (write back) no load data into cache and proceed as if it were a hit (write allocate) update main memory without bringing the block into the cache (no write allocate)

Write Policy Write through - all writes go immediately to memory pro: easy to manage con: main memory is slow, therefore writes are slow Write Back - write in the cache and only update memory when the block is removed from the cache pro: fast writes con: inconsistent memory (multicore), may increase read miss time (due writeback of an evicted block)

Write Back To implement, add a dirty bit to the cache Index Value Valid Tag Dirty 1 To implement, add a dirty bit to the cache When data is loaded to the cache it is set to 0 If any byte in the block is modified, set it to 1 When the block is removed from the cache, check the dirty bit if 1 write the block to main memory

3 Causes of cache misses

3 Causes of cache misses Compulsory Capacity Conflict The first time a block is accessed it will never be in the cache. Capacity The program is accessing more data than will fit in the cache (e.g., a 4 KB cache processing a 16 KB array). Conflict The program is using data stored at different memory locations but the same location in the cache.

Improving Cache Performance Compulsory misses can be reduced by increasing the block size This uses spatial locality to preload data near past memory references

Block size example let A be at address 0x7000 0000 int A[1024]; for (i = 0; i < 1024; i++) A[i] = i; 16 Byte Block A[0] A[1] A[2] A[3] Miss, hit, hit, hit, <repeat> 25% miss rate let A be at address 0x7000 0000 Memory accesses: W 0x7000 0000 4 W 0x7000 0004 4 W 0x7000 0008 4 W 0x7000 000C 4 W 0x7000 0010 4 W 0x7000 0014 4 32 Byte Block A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] Miss, hit, hit, hit, hit, hit, hit, hit, <repeat> 12.5% miss rate

Improving Cache Performance Capacity misses are related to the number of indexes in the cache Increasing cache size, increases the number of indexes, and reduces capacity misses Decreasing block size also increases the number of cache indexes and can reduce capacity misses

Improving Cache Performance Conflict misses can be reduced by changing the cache algorithm A direct mapped cache has a many to one mapping of address to cache index We want alternatives

Fully Associative Cache Address Value 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Fully Associative Cache Locate blocks anywhere in the cache cache does not have an index eliminates conflict misses To check for hit, compare every tag in the cache to the tag for the memory address search the cache - O(N) Value Valid Tag