Lecture 24: Memory, VM, Multiproc

Slides:



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

1 Lecture 20: Cache Hierarchies, Virtual Memory Today’s topics:  Cache hierarchies  Virtual memory Reminder:  Assignment 8 will be posted soon (due.
Lecture 18: Multiprocessors
1 Lecture 14: Cache Innovations and DRAM Today: cache access basics and innovations, DRAM (Sections )
1 Lecture 18: Large Caches, Multiprocessors Today: NUCA caches, multiprocessors (Sections ) Reminder: assignment 5 due Thursday (don’t procrastinate!)
1 Lecture 14: Virtual Memory Topics: virtual memory (Section 5.4) Reminders: midterm begins at 9am, ends at 10:40am.
1 Lecture 16: Virtual Memory Today: DRAM innovations, virtual memory (Sections )
The Memory Hierarchy II CPSC 321 Andreas Klappenecker.
Lecture 17: Virtual Memory, Large Caches
1 Lecture 23: Multiprocessors Today’s topics:  RAID  Multiprocessor taxonomy  Snooping-based cache coherence protocol.
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
1 Lecture 14: Virtual Memory Today: DRAM and Virtual memory basics (Sections )
1 Lecture 21: Virtual Memory, I/O Basics Today’s topics:  Virtual memory  I/O overview Reminder:  Assignment 8 due Tue 11/21.
Lecture 37: Chapter 7: Multiprocessors Today’s topic –Introduction to multiprocessors –Parallelism in software –Memory organization –Cache coherence 1.
Lecture 19: Virtual Memory
1 Lecture: Virtual Memory, DRAM Main Memory Topics: virtual memory, TLB/cache access, DRAM intro (Sections 2.2)
1 Lecture: Large Caches, Virtual Memory Topics: cache innovations (Sections 2.4, B.4, B.5)
1 Lecture 13: Cache, TLB, VM Today: large caches, virtual memory, TLB (Sections 2.4, B.4, B.5)
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
1 Chapter Seven CACHE MEMORY AND VIRTUAL MEMORY. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
1 Lecture: Virtual Memory Topics: virtual memory, TLB/cache access (Sections 2.2)
1 Lecture 17: Multiprocessors Topics: multiprocessor intro and taxonomy, symmetric shared-memory multiprocessors (Sections )
1 Lecture: Virtual Memory, DRAM Main Memory Topics: virtual memory, TLB/cache access, DRAM intro (Sections 2.2)
1 Lecture: Large Caches, Virtual Memory Topics: cache innovations (Sections 2.4, B.4, B.5)
CS 704 Advanced Computer Architecture
Memory COMPUTER ARCHITECTURE
Lecture: Large Caches, Virtual Memory
CS161 – Design and Architecture of Computer
Distributed Processors
Lecture: Large Caches, Virtual Memory
CS 704 Advanced Computer Architecture
Lecture: Cache Hierarchies
CS 147 – Parallel Processing
Cache Memory Presentation I
Lecture: Large Caches, Virtual Memory
Lecture: Cache Hierarchies
Lecture 23: Cache, Memory, Security
Lecture: Memory, Multiprocessors
Lecture 21: Memory Hierarchy
Lecture 21: Memory Hierarchy
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Virtual Memory 4 classes to go! Today: Virtual Memory.
Shared Memory Multiprocessors
Lecture: DRAM Main Memory
Lecture 23: Cache, Memory, Virtual Memory
Chapter 17 Parallel Processing
Lecture 22: Cache Hierarchies, Memory
Lecture: DRAM Main Memory
Lecture: DRAM Main Memory
Lecture: Cache Innovations, Virtual Memory
Lecture 22: Cache Hierarchies, Memory
Multiprocessors - Flynn’s taxonomy (1966)
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Lecture 20: OOO, Memory Hierarchy
Lecture 20: OOO, Memory Hierarchy
Lecture 15: Memory Design
Lecture 25: Multiprocessors
Lecture 22: Cache Hierarchies, Memory
Lecture 11: Cache Hierarchies
Lecture 17: Multi-threaded Applications
CSE451 Virtual Memory Paging Autumn 2002
Lecture: Cache Hierarchies
CSC3050 – Computer Architecture
Lecture 21: Memory Hierarchy
Chapter 4 Multiprocessors
Lecture 24: Virtual Memory, Multiprocessors
Lecture 23: Virtual Memory, Multiprocessors
Presentation transcript:

Lecture 24: Memory, VM, Multiproc Today’s topics: Security wrap-up Off-chip Memory Virtual memory Multiprocessors, cache coherence

Spectre: Variant 1 x is controlled by attacker Thanks to bpred, x can be anything array1[ ] is the secret if (x < array1_size) y = array2[ array1[x] ]; Victim Code Access pattern of array2[ ] betrays the secret

Spectre: Variant 2 Victim code R1  (from attacker) R2  some secret Label0: if (…) Attacker code Label0: if (1) Label1: … … … Victim code Label1: lw [R1] or lw [R2]

Off-Chip DRAM Main Memory Main memory is stored in DRAM cells that have much higher storage density DRAM cells lose their state over time – must be refreshed periodically, hence the name Dynamic A number of DRAM chips are aggregated on a DIMM to provide high capacity – a DIMM is a module that plugs into a bus on the motherboard DRAM access suffers from long access time and high energy overhead

Memory Architecture Processor Bank Memory Controller DIMM Row Buffer Memory Controller Address/Cmd DIMM Data DIMM: a PCB with DRAM chips on the back and front The memory system is itself organized into ranks and banks; each bank can process a transaction in parallel Each bank has a row buffer that retains the last row touched in a bank (it’s like a cache in the memory system that exploits spatial locality) (row buffer hits have a lower latency than a row buffer miss)

Virtual Memory Processes deal with virtual memory – they have the illusion that a very large address space is available to them There is only a limited amount of physical memory that is shared by all processes – a process places part of its virtual memory in this physical memory and the rest is stored on disk (called swap space) Thanks to locality, disk access is likely to be uncommon The hardware ensures that one process cannot access the memory of a different process

Virtual Memory

Translated to physical Address Translation The virtual and physical memory are broken up into pages 8KB page size Virtual address 13 virtual page number page offset Translated to physical page number Physical address

Memory Hierarchy Properties A virtual memory page can be placed anywhere in physical memory (fully-associative) Replacement is usually LRU (since the miss penalty is huge, we can invest some effort to minimize misses) A page table (indexed by virtual page number) is used for translating virtual to physical page number The page table is itself in memory

TLB Since the number of pages is very high, the page table capacity is too large to fit on chip A translation lookaside buffer (TLB) caches the virtual to physical page number translation for recent accesses A TLB miss requires us to access the page table, which may not even be found in the cache – two expensive memory look-ups to access one word of data! A large page size can increase the coverage of the TLB and reduce the capacity of the page table, but also increases memory waste

TLB and Cache Is the cache indexed with virtual or physical address? To index with a physical address, we will have to first look up the TLB, then the cache  longer access time Multiple virtual addresses can map to the same physical address – must ensure that these different virtual addresses will map to the same location in cache – else, there will be two different copies of the same physical memory word Does the tag array store virtual or physical addresses? Since multiple virtual addresses can map to the same physical address, a virtual tag comparison can flag a miss even if the correct physical memory word is present

Cache and TLB Pipeline Virtually Indexed; Physically Tagged Cache Virtual address Offset Virtual page number Virtual index TLB Tag array Data array Physical page number Physical tag Physical tag comparion Virtually Indexed; Physically Tagged Cache

Bad Events Consider the longest latency possible for a load instruction: TLB miss: must look up page table to find translation for v.page P Calculate the virtual memory address for the page table entry that has the translation for page P – let’s say, this is v.page Q TLB miss for v.page Q: will require navigation of a hierarchical page table (let’s ignore this case for now and assume we have succeeded in finding the physical memory location (R) for page Q) Access memory location R (find this either in L1, L2, or memory) We now have the translation for v.page P – put this into the TLB We now have a TLB hit and know the physical page number – this allows us to do tag comparison and check the L1 cache for a hit If there’s a miss in L1, check L2 – if that misses, check in memory At any point, if the page table entry claims that the page is on disk, flag a page fault – the OS then copies the page from disk to memory and the hardware resumes what it was doing before the page fault … phew!

Multiprocessor Taxonomy SISD: single instruction and single data stream: uniprocessor MISD: no commercial multiprocessor: imagine data going through a pipeline of execution engines SIMD: vector architectures: lower flexibility MIMD: most multiprocessors today: easy to construct with off-the-shelf computers, most flexibility

Memory Organization - I Centralized shared-memory multiprocessor or Symmetric shared-memory multiprocessor (SMP) Multiple processors connected to a single centralized memory – since all processors see the same memory organization  uniform memory access (UMA) Shared-memory because all processors can access the entire memory address space Can centralized memory emerge as a bandwidth bottleneck? – not if you have large caches and employ fewer than a dozen processors

SMPs or Centralized Shared-Memory Processor Processor Processor Processor Caches Caches Caches Caches Main Memory I/O System

Memory Organization - II For higher scalability, memory is distributed among processors  distributed memory multiprocessors If one processor can directly address the memory local to another processor, the address space is shared  distributed shared-memory (DSM) multiprocessor If memories are strictly local, we need messages to communicate data  cluster of computers or multicomputers Non-uniform memory architecture (NUMA) since local memory has lower latency than remote memory

Interconnection network Distributed Memory Multiprocessors Processor & Caches Processor & Caches Processor & Caches Processor & Caches Memory I/O Memory I/O Memory I/O Memory I/O Interconnection network

Title Bullet