ECE 232 L27.Virtual.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 27 Virtual.

Slides:



Advertisements
Similar presentations
Virtual Memory In this lecture, slides from lecture 16 from the course Computer Architecture ECE 201 by Professor Mike Schulte are used with permission.
Advertisements

1 Lecture 13: Cache and Virtual Memroy Review Cache optimization approaches, cache miss classification, Adapted from UCB CS252 S01.
Memory Hierarchy Memory Hierarchy Cache Memory
Virtual Memory. The Limits of Physical Addressing CPU Memory A0-A31 D0-D31 “Physical addresses” of memory locations Data All programs share one address.
CPE 731 Advance Computer Architecture Memory Hierarchy Review Dr. Gheith Abandah Adapted from the slides of Prof. David Patterson, University of California,
Computer Organization CS224 Fall 2012 Lesson 44. Virtual Memory  Use main memory as a “cache” for secondary (disk) storage l Managed jointly by CPU hardware.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
CSIE30300 Computer Architecture Unit 10: Virtual Memory Hsin-Chou Chi [Adapted from material by and
Virtual Memory Hardware Support
Cs 325 virtualmemory.1 Accessing Caches in Virtual Memory Environment.
The Memory Hierarchy (Lectures #24) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer Organization.
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
Chap. 7.4: Virtual Memory. CS61C L35 VM I (2) Garcia © UCB Review: Caches Cache design choices: size of cache: speed v. capacity direct-mapped v. associative.
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley and Rabi Mahapatra & Hank Walker.
Now, Review of Memory Hierarchy
Translation Look-Aside Buffers TLBs usually small, typically entries Like any other cache, the TLB can be fully associative, set associative,
Virtual Memory.
S.1 Review: The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of.
Recap. The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of the.
COMP 3221: Microprocessors and Embedded Systems Lectures 27: Virtual Memory - II Lecturer: Hui Wu Session 2, 2005 Modified.
1 COMP 206: Computer Architecture and Implementation Montek Singh Mon, Oct 31, 2005 Topic: Memory Hierarchy Design (HP3 Ch. 5) (Caches, Main Memory and.
1 COMP 206: Computer Architecture and Implementation Montek Singh Mon., Nov. 3, 2003 Topic: Memory Hierarchy Design (HP3 Ch. 5) (Caches, Main Memory and.
CIS °The Five Classic Components of a Computer °Today’s Topics: Memory Hierarchy Cache Basics Cache Exercise (Many of this topic’s slides were.
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
CS 430 – Computer Architecture 1 CS 430 – Computer Architecture Virtual Memory William J. Taffe using slides of David Patterson.
Cs 61C L18 Cache2.1 Patterson Spring 99 ©UCB CS61C Improving Cache Memory and Virtual Memory Introduction Lecture 18 April 2, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson)
Memory: Virtual MemoryCSCE430/830 Memory Hierarchy: Virtual Memory CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng Zhu.
Vm Computer Architecture Lecture 16: Virtual Memory.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
COMP3221 lec37-vm-II.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 13: Virtual Memory - II
Levels of the Memory Hierarchy CPU Registers 100s Bytes
CPE 442 vm.1 Introduction To Computer Architecture CpE 442 Virtual Memory.
CSE431 L22 TLBs.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 22. Virtual Memory Hardware Support Mary Jane Irwin (
CS 224 Spring 2011 Chapter 5B Computer Organization CS224 Chapter 5B: Exploiting the Memory Hierarchy, Part 2 Spring 2011 With thanks to M.J. Irwin, D.
CPE432 Chapter 5A.1Dr. W. Abu-Sufah, UJ Chapter 5B:Virtual Memory Adapted from Slides by Prof. Mary Jane Irwin, Penn State University Read Section 5.4,
CpE 442 Virtual Memory Start: X:40.
1  1998 Morgan Kaufmann Publishers Recap: Memory Hierarchy of a Modern Computer System By taking advantage of the principle of locality: –Present the.
EEL5708/Bölöni Lec 4.1 Fall 2004 September 10, 2004 Lotzi Bölöni EEL 5708 High Performance Computer Architecture Review: Memory Hierarchy.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Review (1/2) °Caches are NOT mandatory: Processor performs arithmetic Memory stores data Caches simply make data transfers go faster °Each level of memory.
Vm.1 EEL-4713 Computer Architecture Virtual Memory.
Virtual Memory Additional Slides Slide Source: Topics Address translation Accelerating translation with TLBs class12.ppt.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
CS.305 Computer Architecture Memory: Virtual Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly made available.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
Improving Memory Access 2/3 The Cache and Virtual Memory
For each of these, where could the data be and how would we find it? TLB hit – cache or physical memory TLB miss – cache, memory, or disk Virtual memory.
Summary of caches: The Principle of Locality: –Program likely to access a relatively small portion of the address space at any instant of time. Temporal.
Virtual Memory Slides adapted from Dr. Valeriu Bieu, (Washington State University, EE 334, Spring 2005) (originally adapted from Dr. David Patterson, UC.
CS161 – Design and Architecture of Computer
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Since 1980, CPU has outpaced DRAM ...
CS352H: Computer Systems Architecture
Virtual Memory Provides illusion of very large memory
CS 704 Advanced 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.
Morgan Kaufmann Publishers
Chapter 4 Large and Fast: Exploiting Memory Hierarchy Part 2 Virtual Memory 박능수.
Review (1/2) Caches are NOT mandatory:
CMSC 611: Advanced Computer Architecture
5 Basic Cache Optimizations
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
CSC3050 – Computer Architecture
September 1, 2000 Prof. John Kubiatowicz
Virtual Memory Lecture notes from MKP and S. Yalamanchili.
Presentation transcript:

ECE 232 L27.Virtual.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 27 Virtual Memory Maciej Ciesielski

ECE 232 L27.Virtual.2 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers °The Five Classic Components of a Computer °Today’s Topics: Virtual Memory Protection TLB The Big Picture: Where are We Now? Control Datapath Memory Processor Input Output

ECE 232 L27.Virtual.3 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Recall: Levels of the Memory Hierarchy CPU Registers 100s Bytes <10s ns Cache K Bytes ns $ /bit Main Memory M Bytes 100ns-1us $ Disk G Bytes ms cents Capacity Access Time Cost Tape infinite sec-min Registers Cache Memory Disk Tape Instr. Operands Blocks Pages Files Staging Xfer Unit prog./compiler 1-8 bytes cache cntl bytes OS 512-4K bytes user/operator Mbytes Upper Level Lower Level faster Larger

ECE 232 L27.Virtual.4 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Basic Issues in Virtual Memory System Design Size of information blocks that are transferred from secondary to main storage (M) Block of information brought into M, and M is full, then some region of M must be released to make room for the new block --> replacement policy Which region of M is to hold the new block --> placement policy Missing item fetched from secondary memory only on the occurrence of a fault --> demand load policy Paging Organization virtual and physical address space partitioned into blocks of equal size page frames pages reg cache mem disk frame

ECE 232 L27.Virtual.5 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Address Map V = {0, 1,..., n - 1} virtual address space M = {0, 1,..., m - 1} physical address space MAP: V --> M U {0} address mapping function n > m MAP(a) = a' if data at virtual address a is present in physical address a' and a' in M = 0 if data at virtual address a is not present in M Processor Name Space V Addr Trans Mechanism fault handler Main Memory Secondary Memory a a a' 0 missing item fault physical address OS performs this transfer

ECE 232 L27.Virtual.6 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Paging Organization Address Mapping VApage no.disp 10 Page Table index into page table Page Table Base Reg V Access Rights PA + table located in physical memory physical memory address actually, concatenation is more likely Virtual Memory frame P.A. Physical Memory 1K Addr Trans MAP page K unit of mapping also unit of transfer from virtual to physical memory V.A.

ECE 232 L27.Virtual.7 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Virtual Address and a Cache CPU Trans- lation Cache Main Memory VAPA miss hit data It takes an extra memory access to translate VA to PA This makes cache access very expensive, and this is the "innermost loop" that you want to go as fast as possible ASIDE: Why access cache with PA at all? VA caches have a problem! synonym / alias problem: two different virtual addresses map to same physical address => two different cache entries holding data for the same physical address! For update: must update all cache entries with same physical address or memory becomes inconsistent Determining this requires significant hardware, essentially an associative lookup on the physical address tags to see if you have multiple hits; or Software enforced alias boundary: same lsb of VA &PA > cache size

ECE 232 L27.Virtual.8 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers TLBs (Translation Look-aside Buffer) A way to speed up translation is to use a special cache of recently used page table entries -- this has many names, but the most frequently used is Translation Lookaside Buffer or TLB Virtual Address Physical Address Dirty Ref Valid Access TLB access time comparable to cache access time (much less than main memory access time)

ECE 232 L27.Virtual.9 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Translation Look-Aside Buffers Just like any other cache, the TLB can be organized as fully associative, set associative, or direct mapped TLBs are usually small, typically not more than entries even on high end machines. This permits fully associative lookup on these machines. Most mid-range machines use small n-way set associative organizations. hit Translation with a TLB CPU TLB Lookup Cache Main Memory VAPA miss hit data Trans- lation miss 20 t t 1/2 t

ECE 232 L27.Virtual.10 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Reducing Translation Time °Machines with TLBs go one step further to reduce # cycles/cache access °They overlap the cache access with the TLB access °Works because high order bits of the VA are used to look in the TLB, while low order bits are used as index into cache

ECE 232 L27.Virtual.11 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Overlapped Cache & TLB Access TLB Cache bytes index 1 K page #disp assoc lookup 32 PA Hit/ Miss PA Data Hit/ Miss = IF cache hit AND (cache tag = PA) then deliver data to CPU ELSE IF [cache miss OR (cache tag = PA)] and TLB hit THEN access memory with the PA from the TLB ELSE do standard VA translation

ECE 232 L27.Virtual.12 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Problems With Overlapped TLB Access Overlapped access only works as long as the address bits used to index into the cache do not change as the result of VA translation This usually limits things to small caches, large page sizes, or high n-way set associative caches if you want a large cache Example: suppose everything the same except that the cache is increased to 8 K bytes instead of 4 K: virt page #disp cache index This bit is changed by VA translation, but is needed for cache lookup Solutions: - go to 8K byte page sizes; - go to 2 way set associative cache; or - SW guarantee VA[13]=PA[13] 1K way set assoc cache

ECE 232 L27.Virtual.13 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Summary #1 / 2 : TLB, Virtual Memory °The Principle of Locality (Temporal, Spatial): Program likely to access a relatively small portion of the address space at any instant of time. °Caches, TLBs, Virtual Memory all understood by examining how they deal with 4 questions: 1. Where can block be placed? 2. How is block found? 3. What block is repalced on miss? 4. How are writes handled? °Page tables map virtual address to physical address °TLBs are important for fast translation °TLB misses are significant in processor performance (most systems can’t access all of 2nd level cache without TLB misses!)

ECE 232 L27.Virtual.14 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Summary #2 / 2: Memory Hierarchy °VIrtual memory was controversial at the time: can SW automatically manage 64KB across many programs? 1000X DRAM growth removed the controversy °Today VM allows many processes to share single memory without having to swap all processes to disk; VM protection is more important than memory hierarchy °Today CPU time is a function of (ops, cache misses) vs. just f(ops): What does this mean to Compilers, Data structures, Algorithms?