CPE300: Digital System Architecture and Design

Similar documents
CPE300: Digital System Architecture and Design

Fig 7.30 The Cache Mapping Function. Memory Fields and Address Translation

Chapter 7- Memory System Design

a process may be swapped in and out of main memory such that it occupies different regions

Chapter 8. Virtual Memory

The Memory System. Components of the Memory System. Problems with the Memory System. A Solution

Memory and multiprogramming

Memory Hierarchy. Goal: Fast, unlimited storage at a reasonable cost per bit.

Chapter 4 Memory Management

Memory Management! How the hardware and OS give application pgms:" The illusion of a large contiguous address space" Protection against each other"

Memory Management. Goals of this Lecture. Motivation for Memory Hierarchy

Eastern Mediterranean University School of Computing and Technology CACHE MEMORY. Computer memory is organized into a hierarchy.

LECTURE 11. Memory Hierarchy

Memory Management! Goals of this Lecture!

Memory Design. Cache Memory. Processor operates much faster than the main memory can.

Virtual Memory. Chapter 8

MEMORY MANAGEMENT/1 CS 409, FALL 2013

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

Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015

1. Creates the illusion of an address space much larger than the physical memory

Virtual Memory. control structures and hardware support

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institute of Technology, Delhi

ECE468 Computer Organization and Architecture. Virtual Memory

ECE4680 Computer Organization and Architecture. Virtual Memory

CS399 New Beginnings. Jonathan Walpole

Virtual or Logical. Logical Addr. MMU (Memory Mgt. Unit) Physical. Addr. 1. (50 ns access)

ECE 341. Lecture # 18

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

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

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1

Operating Systems Lecture 6: Memory Management II

Chapter 3 - Memory Management

Virtual to physical address translation

The memory of a program. Paging and Virtual Memory. Swapping. Paging. Physical to logical address mapping. Memory management: Review

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

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

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Course Outline. Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Memory Management. Chapter 4 Memory Management. Multiprogramming with Fixed Partitions. Ideally programmers want memory that is.

Chapter 8 Virtual Memory

CS 333 Introduction to Operating Systems. Class 11 Virtual Memory (1) Jonathan Walpole Computer Science Portland State University

V. Primary & Secondary Memory!

LECTURE 12. Virtual Memory

Handout 4 Memory Hierarchy

Chapter 8 Virtual Memory

EITF20: Computer Architecture Part 5.1.1: Virtual Memory

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

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

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

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

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner

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

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

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

Chapter 5 Memory Hierarchy Design. In-Cheol Park Dept. of EE, KAIST

Cache memory. Lecture 4. Principles, structure, mapping

Question 13 1: (Solution, p 4) Describe the inputs and outputs of a (1-way) demultiplexer, and how they relate.

Pipelined processors and Hazards

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management

Computer Systems. Virtual Memory. Han, Hwansoo

Page 1. Review: Address Segmentation " Review: Address Segmentation " Review: Address Segmentation "

198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14

Memory Technologies. Technology Trends

The levels of a memory hierarchy. Main. Memory. 500 By 1MB 4GB 500GB 0.25 ns 1ns 20ns 5ms

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Process size is independent of the main memory present in the system.

Donn Morrison Department of Computer Science. TDT4255 Memory hierarchies

CMPSC 311- Introduction to Systems Programming Module: Caching

Assignment 1 due Mon (Feb 4pm

Virtual Memory Virtual memory first used to relive programmers from the burden of managing overlays.

Modern Computer Architecture

Recall from Tuesday. Our solution to fragmentation is to split up a process s address space into smaller chunks. Physical Memory OS.

Memory. Objectives. Introduction. 6.2 Types of Memory

Chapter 6 Caches. Computer System. Alpha Chip Photo. Topics. Memory Hierarchy Locality of Reference SRAM Caches Direct Mapped Associative

Advanced Memory Organizations

Logical Diagram of a Set-associative Cache Accessing a Cache

Carnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition

Memory Management. Goals of Memory Management. Mechanism. Policies

Topics in Memory Subsystem

CISC 662 Graduate Computer Architecture Lecture 16 - Cache and virtual memory review

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

Reducing Hit Times. Critical Influence on cycle-time or CPI. small is always faster and can be put on chip

Virtual Memory: From Address Translation to Demand Paging

UNIT III MEMORY MANAGEMENT

Introduction. Memory Hierarchy

Address spaces and memory management

Computer Architecture. Lecture 8: Virtual Memory

COEN-4730 Computer Architecture Lecture 3 Review of Caches and Virtual Memory

[ 6.1] A cache is a small, fast memory which is transparent to the processor. The cache duplicates information that is in main memory.

CHAPTER 4 MEMORY HIERARCHIES TYPICAL MEMORY HIERARCHY TYPICAL MEMORY HIERARCHY: THE PYRAMID CACHE PERFORMANCE MEMORY HIERARCHIES CACHE DESIGN

CS252 S05. Main memory management. Memory hardware. The scale of things. Memory hardware (cont.) Bottleneck

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2014 Lecture 14

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)

EITF20: Computer Architecture Part 5.1.1: Virtual Memory

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

UCB CS61C : Machine Structures

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy

ECE7995 Caching and Prefetching Techniques in Computer Systems. Lecture 8: Buffer Cache in Main Memory (I)

COSC 6385 Computer Architecture. - Memory Hierarchies (I)

Transcription:

CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Virtual Memory 11282011 http://www.egr.unlv.edu/~b1morris/cpe300/

2 Outline Review Cache Virtual Memory Projects

3 Memory Hierarchy, Cost, Performance 1. Registers internal to CPU 2. Cache levels 3. Main memory

4 Memory Hierarchy Combine smaller, faster memory with slower, larger memory Primary and secondary levels (e.g. cache and main memory) Move data efficiently from slow to fast memory using principle of locality Programs tend to reference a confined area of memory repeatedly Spatial locality if a given memory location is referenced, addresses near it will likely be referenced soon Temporal locality if a given memory location is referenced, it is likely to be referenced again soon Working set set of memory locations referenced over a fixed time window

5 Hits and Misses Hit word is found at level requested # hits Hit ratio (hit rate) - h = total # references Miss word not found at level requested Must request for containing block in the next higher level in memory hierarchy Miss ratio = 1 h Access time t a = ht p + (1 h)t s t p - primary memory access time t s - secondary memory access time

6 Cache Insertion of high speed memory between CPU and main memory May have more than one cache level Caching is usually transparent to programmer Caching operations must be handled in hardware Cache blocks are item of commerce Block sizes in range of 16-256 bytes

7 Cache Mapping Function Responsible for all cache operations Placement strategy where to place an incoming block in cache Replacement strategy which block to replace upon miss Read/write policy how to handle reads and writes upon cache hits and misses Three common mapping functions Associative Direct-mapped Block-set-associative combination of associative and directmapped

8 Associative Mapped Cache Any block from main memory can be put anywhere in cache Example: 16-bit address Cache structure: One set of 256 lines 256 block capacity 2 8 = 256 8-byte blocks 3-bits for byte sized word Main memory has 2 13 = 8192 8-byte blocks 256 x 13-bit tag memory Indicates block number in cache position 256 x 1-bit valid memory Indicates if cache location has a value

9 Properties of Associative Cache Advantage Most flexible mapping because a main memory block can go anywhere in the cache Disadvantage Large tag memory required Must search entire tag memory simultaneously lots of hardware required Replacement policy when cache is full causes issue

10 Direct Mapped Cache Divide main memory into sets All blocks in a set (group) can go into only one cache location Example: 16-bit main memory address 256 x 8-byte cache The number of cache lines determines the number of sets Cache only examines single group

11 Properties of Direct Mapped Cache Advantage Requires less hardware than associative Simple (trivial) replacement policy Disadvantage Simple replacement policy Restrictive poor use of cache space Thrashing two blocks from the same group that are frequently referenced will compete for the same cache location Cause frequent switching of cache data and performance degradation

12 Block-Set-Associative Cache Compromise between associative and direct-mapped to allow several cache blocks for each memory group Example: 2-way set associative cache A set of 2 cache values per group 256 x 2 x 8-byte cache 256 sets of 2 lines each Operation is same as direct-mapped Must do associative comparison between tag and cache memory Copy of direct mapped hardware for each set

13 Cache Read/Write Policies Hit policies Write-through updates both cache and main memory upon each write Write-back updates only cache Update main memory only upon removal of block Dirty bit is set upon first write to indicate block must be written back Miss Policies Read miss bring block in from main memory Forward word as brought into cache Wait until entire line is filled then repeat cache request Write miss Write allocate bring block into cache, then update Write-no allocate write word to main memory without bringing block into cache

14 Block Replacement Strategies Not needed with direct-mapped cache Least recently used (LRU) Track cache usage with counter Each block access causes Clear counter of accessed block Increment counters with values less than block being accessed All others remain unchanged When set is full, remove line with highest count Random replacement replace block at random Actually effective strategy in practice

15 Virtual Memory Hierarchy Memory hierarchy usually of main memory and disk Enormous speed difference between main memory and disk Order of 10 6 factor Processor should not be kept waiting for transfer into memory upon miss Multiprogramming shares the processor among independent programs stored in memory On miss switch to another program Miss response can be assisted by processor I/O, placement/replacement decisions, computations of disk addresses

16 Virtual Memory Technique to use secondary storage (disks) to extend the apparent size of physical memory Each process views memory as if it were its own Not restricted to physical size of memory Logical address space now usually larger than physical memory Memory management unit (MMU) Responsible for mapping logical addresses issued by CPU into physical addresses that are presented to cache and main memory Mapping tables are used OS assists with selecting data appropriately for working set

17 Paging and Block Placement Page commonly used name for a disk block Page fault synonymous with a miss Demand paging pages moved from disk to main memory only when a word in the page is requested by the processor Block placement/replacement decisions must be made each time a block is moved Placement where a block should go Replacement what blocks can be removed to make room for new block

18 MMU and Address Translation CPU Chip Effective address address computed by processor while executing a program Logical address synonymous with EA but generally used to refer to address when viewed from outside the CPU Virtual address address generated from logical address by MMU Physical address address presented to the memory unit Note: every address reference must be translated

19 Virtual Addresses Virtual address space is larger than logical address programs appear to get more memory Example: PowerPC 601 32-bit logical addresses Maximum space allowed for a process 52-bit virtual addresses from MMU translation Process limited to 32-bits but main memory could hold many processes

20 Virtual Addressing Advantages Simplified addressing each program can be compiled into its own memory space (starting at address 0) and could extend beyond physical memory present in system No address relocation required at load time No need to fragment program to accommodate memory limits Cost effective use of physical memory less expensive secondary storage (disk) can replace primary storage (RAM) MMU brings in portions of program to physical memory as required Access control each memory reference is translated so it can be simultaneously checked for read/write/execute privileges Hardware-level access control

21 Memory Management by Segmentation Allows memory to be divided into segments of varying sizes Less common than paged virtual memory Each segment begins at virtual memory address 0 Segments loaded into/out memory as needed Gaps between segments are called external fragmentation Gaps could result in unusable gaps of memory

22 Segmentation Mechanism Physical addresses are computed in the MMU Virtual address is added (integer addition) to segment base register Segment limits may optionally be maintained for error checks MMU can switch between separate segments Adjust segment registers Use segment tables One segment per program unit

23 Memory Management by Paging Memory divided into fixed-size pages 512-8K bytes Virtual memory is ordered into linear ascending order Necessary for simple page number concatenation for addressing MMU maps logical address to physical address May be out of order in memory Page n-1 is not in physical memory by secondary (disk) Demand paging only brings pages into memory when needed

24 Paging Address Translation More complex mapping process than segmentation More pages than segments How many pages per program? Page table maps virtual pages to physical pages (or secondary memory) Typically 1 page table per user per program unit Control fields Access bits read/write/execute permissions Usage bits for replacement Physical address is from concatenation of page number and word offset Page fault causes exception and the slow update of memory from disk Internal fragmentation because a program will most likely not end at page Trade-off between page size and secondary update rate

25 Page Placement and Replacement Page tables are direct mapped Physical page computed directly from virtual page number But, physical pages can reside anywhere in physical memory (like associative cache) Page tables as shown (slide 24) result in large page tables because each program requires a page table entry for every page Can instead use multilevel page tables root page table pointing to other page tables in hierarchy Hash tables used to index only entries present in physical memory Replacement strategies are generally LRU Use bit necessary to determine stale pages

26 Fast Address Translation Virtual memory is attractive but has considerable overhead 2 memory references required for each actual memory reference First to retrieve page table entry Second to access physical memory location Translation from virtual to physical address translation must happen before cache access Caches designed for physical addresses Translation lookaside buffer (TLB) is a small cache for virtual/physical address translations Allows processor to access physical memory directly TLB maintains valid, dirty, protection bits Usually implemented as fully associative cache for flexibility

Operation of Memory Hierarchy 27

28 Memory System Design Summary Multilevel storage system of modern computer Cache, main memory, disk Semiconductor RAM static and dynamic Used at fastest levels of memory hierarchy RAM speeds has greatest influence on memory system performance Chips arranged into boards and modules 2-level memory hierarchy used to connected small and fast with larger, slower memory Cache and main memory is the fastest/closest pair and requires hardware operation Virtual memory is name of main memory/disk pair and because of slower access can be software managed