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

Similar documents
Chapter 6 Objectives

Memory. Objectives. Introduction. 6.2 Types of Memory

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

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

Chapter 6 Objectives

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

MEMORY. Objectives. L10 Memory

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

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Chapter 7 Large and Fast: Exploiting Memory Hierarchy. Memory Hierarchy. Locality. Memories: Review

Memory Hierarchies. Instructor: Dmitri A. Gusev. Fall Lecture 10, October 8, CS 502: Computers and Communications Technology

The University of Adelaide, School of Computer Science 13 September 2018

Chapter Seven. Large & Fast: Exploring Memory Hierarchy

Chapter Seven. Memories: Review. Exploiting Memory Hierarchy CACHE MEMORY AND VIRTUAL MEMORY

CENG3420 Lecture 08: Memory Organization

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

CENG4480 Lecture 09: Memory 1

Logic and Computer Design Fundamentals. Chapter 8 Memory Basics

LECTURE 11. Memory Hierarchy

Donn Morrison Department of Computer Science. TDT4255 Memory hierarchies

Memory systems. Memory technology. Memory technology Memory hierarchy Virtual memory

Lecture 18: Memory Systems. Spring 2018 Jason Tang

Memory. Lecture 22 CS301

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 27, SPRING 2013

,e-pg PATHSHALA- Computer Science Computer Architecture Module 25 Memory Hierarchy Design - Basics

CPS101 Computer Organization and Programming Lecture 13: The Memory System. Outline of Today s Lecture. The Big Picture: Where are We Now?

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

Chapter Seven. SRAM: value is stored on a pair of inverting gates very fast but takes up more space than DRAM (4 to 6 transistors)

ECE232: Hardware Organization and Design

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 26, FALL 2012

Recap: Machine Organization

Large and Fast: Exploiting Memory Hierarchy

Course Administration

Memory Hierarchy, Fully Associative Caches. Instructor: Nick Riasanovsky

The Memory Hierarchy. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 3, 2018 L13-1

Cycle Time for Non-pipelined & Pipelined processors

Memory memories memory

Caches. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Chapter 5. Memory Technology

Memory Hierarchy. Memory Flavors Principle of Locality Program Traces Memory Hierarchies Associativity. (Study Chapter 5)

Chapter 5 Large and Fast: Exploiting Memory Hierarchy (Part 1)

k -bit address bus n-bit data bus Control lines ( R W, MFC, etc.)

Computer Organization and Assembly Language (CS-506)

Design and Implementation of an AHB SRAM Memory Controller

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

The Memory Hierarchy & Cache

ECE 2300 Digital Logic & Computer Organization. Caches

Memory Hierarchies &

Memory Technology. Caches 1. Static RAM (SRAM) Dynamic RAM (DRAM) Magnetic disk. Ideal memory. 0.5ns 2.5ns, $2000 $5000 per GB

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

CS152 Computer Architecture and Engineering Lecture 16: Memory System

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

CSE 2021: Computer Organization

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

Chapter 4 Main Memory

ECE 341. Lecture # 16

Lecture-14 (Memory Hierarchy) CS422-Spring

The Memory Hierarchy Cache, Main Memory, and Virtual Memory

Internal Memory Cache Stallings: Ch 4, Ch 5 Key Characteristics Locality Cache Main Memory

CSE 2021: Computer Organization

Memory classification:- Topics covered:- types,organization and working

Module 5a: Introduction To Memory System (MAIN MEMORY)

Locality. Cache. Direct Mapped Cache. Direct Mapped Cache

Concept of Memory. The memory of computer is broadly categories into two categories:

ECE468 Computer Organization and Architecture. Memory Hierarchy

CMPSC 311- Introduction to Systems Programming Module: Caching

LECTURE 10: Improving Memory Access: Direct and Spatial caches

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

Plot SIZE. How will execution time grow with SIZE? Actual Data. int array[size]; int A = 0;

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2014 Lecture 14

Contents. Memory System Overview Cache Memory. Internal Memory. Virtual Memory. Memory Hierarchy. Registers In CPU Internal or Main memory

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

Memory Pearson Education, Inc., Hoboken, NJ. All rights reserved.

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Chapter 5 Internal Memory

Question?! Processor comparison!

Basic Memory Hierarchy Principles. Appendix C (Not all will be covered by the lecture; studying the textbook is recommended!)

Overview. Memory Classification Read-Only Memory (ROM) Random Access Memory (RAM) Functional Behavior of RAM. Implementing Static RAM

CpE 442. Memory System

Copyright 2012, Elsevier Inc. All rights reserved.

Computer Architecture. A Quantitative Approach, Fifth Edition. Chapter 2. Memory Hierarchy Design. Copyright 2012, Elsevier Inc. All rights reserved.

Welcome to Part 3: Memory Systems and I/O

The memory gap. 1980: no cache in µproc; level cache on Alpha µproc

Cache introduction. April 16, Howard Huang 1

The Memory Hierarchy. Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab M.I.T.

Organization. 5.1 Semiconductor Main Memory. William Stallings Computer Organization and Architecture 6th Edition

EEC 483 Computer Organization

Copyright 2012, Elsevier Inc. All rights reserved.

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

CMPSC 311- Introduction to Systems Programming Module: Caching

William Stallings Computer Organization and Architecture 6th Edition. Chapter 5 Internal Memory

Technology in Action

14:332:331. Week 13 Basics of Cache

Memory Hierarchy: Caches, Virtual Memory

Memory Overview. Overview - Memory Types 2/17/16. Curtis Nelson Walla Walla University

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

CPU issues address (and data for write) Memory returns data (or acknowledgment for write)

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

7/28/ Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc.

LECTURE 5: MEMORY HIERARCHY DESIGN

Transcription:

Announcement Computer Architecture (CSC-350) Lecture 0 (08 April 008) Seung-Jong Park (Jay) http://www.csc.lsu.edu/~sjpark Chapter 6 Objectives 6. Introduction Master the concepts of hierarchical memory organization. Understand how each level of memory contributes to system performance, and how the performance is measured. Master the concepts behind cache memory, virtual memory, memory segmentation, paging and address translation. Memory lies at the heart of the stored-program computer. In previous chapters, we studied the components from which memory is built and the ways in which memory is accessed by various ISAs. In this chapter, we focus on memory organization. A clear understanding of these ideas is essential for the analysis of system performance. 3 4 6. Types of Memory 6. Types of Memory There are two kinds of main memory: random access memory, RAM, and read-only-memory, ROM. There are two types of RAM, dynamic RAM (DRAM) and static RAM (SRAM). Dynamic RAM consists of capacitors that slowly leak their charge over time. Thus they must be refreshed every few milliseconds to prevent data loss. DRAM is cheap memory owing to its simple design. SRAM consists of circuits similar to the D flip-flop that we studied in Chapter 3. SRAM is very fast memory and it doesn t need to be refreshed like DRAM does. It is used to build cache memory, which we will discuss in detail later. ROM also does not need to be refreshed, either. In fact, it needs very little charge to retain its memory. ROM is used to store permanent, or semipermanent data that persists even while the system is turned off. 5 6

Memories: Review SRAM: value is stored on a pair of inverting gates very fast but takes up more space than DRAM (more # of transistors) DRAM: value is stored as a charge on capacitor (must be refreshed) very small but slower than SRAM (factor of 5 to 0) Capacitor can hold charge Transistor acts as gate No charge is a 0 Can close switch & add charge to store a Then open switch (disconnect) Can read by closing switch Synchronous DRAM (SDRAM) Has a clock Common type in PCs late-90s Typical DRAMs still synchronous Multiple banks Pipelined Start read in one bank after another Come back and read the resulting values one after another 8 DDR DRAM Summary - Memory Double Data Rate SDRAM Transfers data on both edges of the clock Currently popular Attempt to alleviate the pinout problems RAMs with different characteristics For different purposes Static RAM Simple to use, small, expensive Fast, used for cache Dynamic RAM Complex to interface, largest, cheap Needs periodic refresh 9 0 Generally speaking, faster memory is more expensive than slower memory. To provide the best performance at the lowest cost, memory is organized in a hierarchical fashion. Small, fast storage elements are kept in the CPU, larger, slower main memory is accessed through the data bus. Larger, (almost) permanent storage in the form of disk and tape drives is still further from the CPU. This storage organization can be thought of as a pyramid:

To access a particular piece of data, the CPU first sends a request to its nearest memory, usually cache. If the data is not in cache, then main memory is queried. If the data is not in main memory, then the request goes to disk. Once the data is located, then the data, and a number of its nearby data elements are fetched into cache memory. This leads us to some definitions. A hit is when data is found at a given memory level. A miss is when it is not found. The hit rate is the percentage of time data is found at a given memory level. The miss rate is the percentage of time it is not. Miss rate = - hit rate. The hit time is the time required to access data at a given memory level. The miss penalty is the time required to process a miss, including the time that it takes to replace a block of memory plus the time it takes to deliver the data to the processor. 3 4 An entire blocks of data is copied after a hit because the principle of locality tells us that once a byte is accessed, it is likely that a nearby data element will be needed soon. There are three forms of locality: Temporal locality- Recently-accessed data elements tend to be accessed again. Spatial locality - Accesses tend to cluster. Sequential locality - Instructions tend to be accessed sequentially. The purpose of cache memory is to speed up accesses by storing recently used data closer to the CPU, instead of storing it in main memory. Although cache is much smaller than main memory, its access time is a fraction of that of main memory. Unlike main memory, which is accessed by address, cache is typically accessed by content; hence, it is often called content addressable memory. Because of this, a single large cache memory isn t always desirable-- it takes longer to search. 5 6 The content that is addressed in content addressable cache memory is a subset of the bits of a main memory address called a field. The fields into which a memory address is divided provide a many-to-one mapping between larger main memory and the smaller cache memory. Many blocks of main memory map to a single block of cache. A tag field in the cache block distinguishes one cached memory block from another. Different Kinds of Cache Direct Mapped Cache Set Associative Cache Fully Associative Cache 7 8 3

(Direct Mapped Cache) The simplest cache mapping scheme is direct mapped cache. In a direct mapped cache consisting of N blocks of cache, block X of main memory maps to cache block Y = X mod N. Thus, if we have 0 blocks of cache, block 7 of cache may hold blocks 7, 7, 7, 37,... of main memory. Once a block of memory is copied into its slot in cache, a valid bit is set for the cache block to let the system know that the block contains valid data. What could happen if there were no valid bit? 9 The diagram below is a schematic of what cache looks like. Block 0 contains multiple words from main memory, identified with the tag 00000000. Block contains words identified with the tag 00. The other two blocks are not valid. 0 Direct Mapped Cache Mapping: address is modulo the number of blocks in the cache Cache 000 00 00 0 00 0 0 The size of each field into which a memory address is divided depends on the size of the cache. Suppose our memory consists of 4 words, cache has 6 = 4 blocks, and each block holds 8 words. Thus memory is divided into 4 / 8 = blocks. For our field sizes, we know we need 4 bits for the block, 3 bits for the word, and the tag is what s left over: 0000 000 000 00 000 00 00 0 Memory As an example, suppose a program generates the address AA. In 4-bit binary, this number is: 000000000. The first 7 bits of this address go in the tag field, the next 4 bits go in the block field, and the final 3 bits indicate the word within the block. If subsequently the program generates the address AB, it will find the data it is looking for in block 00, word 0. However, if the program generates the address, 3AB, instead, the block loaded for address AA would be evicted from the cache, and replaced by the blocks associated with the 3AB reference. 3 4 4

Direct Mapped Cache Address (showing bit positions) 3 30 3 0 Byte offset Hit 0 0 Tag Index Index Valid Tag Data 0 0 0 03 0 3 = Data Suppose a program generates a series of memory references such as: AB, 3AB, AB, 3AB,... The cache will continually evict and replace blocks. The theoretical advantage offered by the cache is lost in this extreme case. This is the main disadvantage of direct mapped cache. Other cache mapping schemes are designed to prevent this kind of thrashing. 6 5