CSC258: Computer Organization. Memory Systems

Similar documents
MIPS) ( MUX

CS 136: Advanced Architecture. Review of Caches

Lecture 17 Introduction to Memory Hierarchies" Why it s important " Fundamental lesson(s)" Suggested reading:" (HP Chapter

Levels in memory hierarchy

CS61C : Machine Structures

CSE 410 Computer Systems. Hal Perkins Spring 2010 Lecture 12 More About Caches

CPSC 313, 04w Term 2 Midterm Exam 2 Solutions

Slide Set 9. for ENCM 369 Winter 2018 Section 01. Steve Norman, PhD, PEng

CS 61C: Great Ideas in Computer Architecture. Direct Mapped Caches

Memory. Lecture 22 CS301

CS 31: Intro to Systems Caching. Martin Gagne Swarthmore College March 23, 2017

CS 2630 Computer Organization. Meeting 13: Faster arithmetic and more operations Brandon Myers University of Iowa

Donn Morrison Department of Computer Science. TDT4255 Memory hierarchies

Announcement. Computer Architecture (CSC-3501) Lecture 20 (08 April 2008) Chapter 6 Objectives. 6.1 Introduction. 6.

Many ways to build logic out of MOSFETs

LECTURE 11. Memory Hierarchy

CS Computer Architecture

CS161 Design and Architecture of Computer Systems. Cache $$$$$

ENCM 369 Winter 2019 Lab 6 for the Week of February 25

Review: Performance Latency vs. Throughput. Time (seconds/program) is performance measure Instructions Clock cycles Seconds.

378: Machine Organization and Assembly Language

10/19/17. You Are Here! Review: Direct-Mapped Cache. Typical Memory Hierarchy

CS61C : Machine Structures

Review : Pipelining. Memory Hierarchy

Let!s go back to a course goal... Let!s go back to a course goal... Question? Lecture 22 Introduction to Memory Hierarchies

Chapter Seven. Large & Fast: Exploring Memory Hierarchy


Question?! Processor comparison!

Assignment 1 due Mon (Feb 4pm

Course Administration

CS152 Computer Architecture and Engineering SOLUTIONS Caches and the Memory Hierarchy Assigned 9/17/2016 Problem Set #2 Due Tue, Oct 4

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Caches Part 3

Lecture 15: Caches and Optimization Computer Architecture and Systems Programming ( )

Comprehensive Exams COMPUTER ARCHITECTURE. Spring April 3, 2006

And in Review! ! Locality of reference is a Big Idea! 3. Load Word from 0x !

CS61C - Machine Structures. Lecture 17 - Caches, Part I. October 25, 2000 David Patterson

Welcome to Part 3: Memory Systems and I/O

Computer Architecture CS372 Exam 3

EEC 170 Computer Architecture Fall Cache Introduction Review. Review: The Memory Hierarchy. The Memory Hierarchy: Why Does it Work?

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Lecture 17: Memory Hierarchy: Cache Design

Chapter 5A. Large and Fast: Exploiting Memory Hierarchy

Key Point. What are Cache lines

CSF Cache Introduction. [Adapted from Computer Organization and Design, Patterson & Hennessy, 2005]

Memory Hierarchy, Fully Associative Caches. Instructor: Nick Riasanovsky

Agenda. Cache-Memory Consistency? (1/2) 7/14/2011. New-School Machine Structures (It s a bit more complicated!)

Caching Basics. Memory Hierarchies

UCB CS61C : Machine Structures

CS 61C: Great Ideas in Computer Architecture. Cache Performance, Set Associative Caches

Cache Memory COE 403. Computer Architecture Prof. Muhamed Mudawar. Computer Engineering Department King Fahd University of Petroleum and Minerals

CS61C : Machine Structures

CS61C Midterm 2 Review Session. Problems Only

Chapter 6 Memory 11/3/2015. Chapter 6 Objectives. 6.2 Types of Memory. 6.1 Introduction

CS61C : Machine Structures

CSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management

Chapter 8. Virtual Memory

(Refer Slide Time: 1:40)

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

CHAPTER 6 Memory. CMPS375 Class Notes (Chap06) Page 1 / 20 Dr. Kuo-pao Yang

CS61C : Machine Structures

The Memory Hierarchy & Cache

UCB CS61C : Machine Structures

CHAPTER 6 Memory. CMPS375 Class Notes Page 1/ 16 by Kuo-pao Yang

Question Points Score Total 100

CS3350B Computer Architecture

Memory Hierarchy. Mehran Rezaei

UC Berkeley CS61C : Machine Structures

CSE 431 Computer Architecture Fall Chapter 5A: Exploiting the Memory Hierarchy, Part 1

Memory Hierarchies &

ECE 571 Advanced Microprocessor-Based Design Lecture 10

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

CMPSC 311- Introduction to Systems Programming Module: Caching

ECE 571 Advanced Microprocessor-Based Design Lecture 13

Paging algorithms. CS 241 February 10, Copyright : University of Illinois CS 241 Staff 1

Lecture 33 Caches III What to do on a write hit? Block Size Tradeoff (1/3) Benefits of Larger Block Size

EE 4683/5683: COMPUTER ARCHITECTURE

Computer Architecture Review. ICS332 - Spring 2016 Operating Systems

Page Replacement. (and other virtual memory policies) Kevin Webb Swarthmore College March 27, 2018

Page 1. Multilevel Memories (Improving performance using a little cash )

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

Memory. Objectives. Introduction. 6.2 Types of Memory

Page 1. CS162 Operating Systems and Systems Programming Lecture 14. Caching and Demand Paging

Computer Systems C S Cynthia Lee Today s materials adapted from Kevin Webb at Swarthmore College

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific $$$ $$$ Cache Memory 2 $$$

Caches and Memory Hierarchy: Review. UCSB CS240A, Winter 2016

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific $$$ $$$ Cache Memory $$$

UCB CS61C : Machine Structures

LECTURE 4: LARGE AND FAST: EXPLOITING MEMORY HIERARCHY

Computer Architecture Memory hierarchies and caches

ECE331: Hardware Organization and Design

Cache memories are small, fast SRAM-based memories managed automatically in hardware. Hold frequently accessed blocks of main memory

CS 152 Computer Architecture and Engineering

Pick a time window size w. In time span w, are there, Multiple References, to nearby addresses: Spatial Locality

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018

CS61C Midterm 2 Review Session. Problems + Solutions

CENG 3420 Computer Organization and Design. Lecture 08: Cache Review. Bei Yu

COSC4201. Chapter 5. Memory Hierarchy Design. Prof. Mokhtar Aboelaze York University

Locality and Data Accesses video is wrong one notes when video is correct

Computer Architecture V Fall Practice Exam Questions

CS 61C: Great Ideas in Computer Architecture Direct- Mapped Caches. Increasing distance from processor, decreasing speed.

Transcription:

CSC258: Computer Organization Memory Systems 1

Summer Independent Studies I m looking for a few students who will be working on campus this summer. In addition to the paid positions posted earlier, I have projects related to data mining (on educational data) and databases. Please check the posting on the discussion board! 2

Something Different... We re not starting today with a quiz. We ll end the day with an activity. 3

Student Opinion Surveys The response rate for this course is... 7% 4

The Memory System 5

Key Computer Systems So far, we ve focused on the processor. That s where execution happens. There are two other key systems: memory and I/O. Memory controls the storage of data. I/O controls the flow of information into and out of the system. 6

Connections to OS We ll focus on the memory system and not talk much about I/O this term. At a high level, the memory system includes RAM, the hard drive, and the communication infrastructure that connects those devices to the processor. We won t discuss the hard drive much. That s the realm of virtual memory, and that s where this material connects with CSC369 (OS). 7

Why is the Memory System Important? Most processor spend most of their time waiting.... often for memory. This is the memory wall. As processors get faster, more processor cycles can be executed before a load completes. Caches are one way to reduce waiting time. 8

A Memory System A whole memory system includes main memory (RAM) and a series of caches. The L1 (level-one) is very close to the processor, and it is quite small. The L2 is a bit further away and a bit bigger. The L3, if there is one, is often off-chip and even larger. The further a cache is from the processor, the more it stores. The size of the cache line shrinks as you get closer to the processor. 9

Caching Caches are a solution that makes it appear that memory is closer than it is. Every load to memory fetches more than just the value that is loaded. In fact, a lot of values -- a block (or line) -- is brought from the memory to a location close to the processor. That location is called a cache. It stores the value that was loaded and the values near it, in case they are needed soon. 10

Locality Locality is one of the big ideas in computer science. In essence, locality is the assumption that history will repeat itself. That: spatial locality: If one object in memory is accessed, objects close to it will also be accessed. temporal locality: If one object is accessed, it (and objects around it) will be accessed again soon. Locality is required for caches to function well. 11

Examples Iterating over an array exhibits both temporal and spatial locality. Executing code often exhibits temporal and spatial locality. Accessing items from a dictionary does not: the items in the dictionary may not be close to each other in memory. Linked lists and other dynamically allocated structures can also cause locality problems. 12

Caches 13

Key Cache Terms Address Tag Block Set Associativity Hit rate (and miss rate) Average Memory Access Time (AMAT) 14

Addresses and Caches Each load fetches an entire cache block -- not just a single value. The size of a cache block is dependent on the cache. A block is a set of words with closely related addresses. The easiest way to define a block is to look at its mask. 15

Bit Masking A bit vector is an integer that should be interpreted as a sequence of bits. We can think of an address as a bit vector. A mask is a value that can be used to turn specific bits in a bit vector on or off. For example, let s set a mod-16 mask. value =... mod_16 = 15 # 0x000000F print (value & mod_16) # Only the bottom 4 bits # & is bitwise and 16

Masking Addresses We can create masks to define different parts of an address. Suppose we have 32-bit (4-byte) words. Suppose an array starts at base. Then the offset is: address =... base =... offset = address & base Similarly, suppose a cache block contains 8 words. Then every block contains the least significant 32-bytes (5 bits) cacheblockoffset = 31 # 0x0000001F cacheblock = maxint - 31 # 0xFFFFFFE0 17

Cache Loading and Evicting Back to caches: every load brings in a block. Each cache has a finite size. It can store some maximum number of blocks. Based on associativity, it can store a set number of blocks with a specific hash. Every time a load is performed from memory, the block must be stored. This means that another block might need to be evicted. 18

Discussion What is the effect of increasing: (a) block size (b) associativity (c) cache size What is the impact of having a two-processor system with: (a) a shared cache (b) separate caches but shared memory 19

Associativity Most caches use some form of hashing. The caches are smaller than the memory they are caching from, so they can t store everything! If two blocks hash to the same value, they can t both be stored. To avoid that, caches are often associative. A 2-way set associative cache can store two blocks that hash to the same value. A fully associative cache doesn t have to worry about hash collisions at all. 20

Eviction Heuristic How do we choose which cache block to remove (evict)? The most common heuristic is least recently used (LRU). The cache block that was accessed the longest time ago is dropped. Other heuristics include first in first out (FIFO), least frequently used, and others. 21

Cache Consistency Consistency is a huge problem -- and we won t discuss it. Imagine a multi-processor system: each processor has its own L1. What happens when one of the processors issues a store? Is it written back to memory? To the other processor s L1? How quickly does that write-back happen? What will occur if the second processor accesses that memory address before the write-back? 22

23

24

Exam Office Hours Monday, April 6: 2-4 Friday, April 17: 2-4 Exam Jam: Tuesday, April 7: 3-5 in IB220 Monday, April 13: 2-4 Monday, April 20: 2-4 Wednesday, April 22: 2-4 (updated)... we know what s scheduled late on the 23rd. 25

Marks and Re-marks Labs and Quizzes: Final lab and quiz marks will be posted by early next week. Once they re posted, I ll post a pre-exam mark (out of 60) that will include any accommodations/missed work that I know of. Re-marks and Reviews: Quizzes not returned in lab will be in my office by Friday. Drop by to pick them up. 26

Exam Details The exam is 3 hours. No aids are permitted. The exam contains a reference sheet with some MIPS information on it. The back pages are scrap. You may tear the last sheet off, if you need it. 27

Exam Format For each question... Use the space available and points assigned as a guide. Spelling and grammar won t be marked, but it s easier to find marks in succinct, well-organized answers. Question material was drawn from the reading and exercises as well as the labs. 28

Topics: Pre-Midterm (40%) CMOS Transistors Logical gates Boolean logic and connection to circuits Simplification and K-maps Devices Higher-level design, abstraction Muxes, demuxes Arithmetic circuits and numeric representations 29

Topics: Pre-Midterm (40%) Sequential logic Latches and flip-flops Registers Latency and clock speed calculations Finite State Machines 30

Topics: Post-Midterm (60%) Machine languages Instruction formats Relation to hardware Assembly languages Relation to machine code and higher-level languages Compiler toolchain Function calls Control structures: branches, loops, functions, exceptions 31

Topics: Post-Midterm (60%) Computer organization The memory system Caches and locality Processor components Memory model (including MIPS registers) 32

Questions? 33