Virtual Memory Overcoming main memory size limitation

Slides:



Advertisements
Similar presentations
1 Lecture 13: Cache and Virtual Memroy Review Cache optimization approaches, cache miss classification, Adapted from UCB CS252 S01.
Advertisements

Virtual Memory. The Limits of Physical Addressing CPU Memory A0-A31 D0-D31 “Physical addresses” of memory locations Data All programs share one address.
Segmentation and Paging Considerations
CSIE30300 Computer Architecture Unit 10: Virtual Memory Hsin-Chou Chi [Adapted from material by and
Virtual Memory Hardware Support
CSC 4250 Computer Architectures December 8, 2006 Chapter 5. Memory Hierarchy.
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.
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Memory Management 2010.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Virtual Memory and Paging J. Nelson Amaral. Large Data Sets Size of address space: – 32-bit machines: 2 32 = 4 GB – 64-bit machines: 2 64 = a huge number.
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
Virtual Memory I Chapter 8.
Memory: Virtual MemoryCSCE430/830 Memory Hierarchy: Virtual Memory CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng Zhu.
A. Frank - P. Weisberg Operating Systems Simple/Basic Paging.
Mem. Hier. CSE 471 Aut 011 Evolution in Memory Management Techniques In early days, single program run on the whole machine –Used all the memory available.
1  1998 Morgan Kaufmann Publishers Chapter Seven Large and Fast: Exploiting Memory Hierarchy (Part II)
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
Operating Systems & Memory Systems: Address Translation Computer Science 220 ECE 252 Professor Alvin R. Lebeck Fall 2008.
CSE431 L22 TLBs.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 22. Virtual Memory Hardware Support Mary Jane Irwin (
Lecture 19: Virtual Memory
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Lecture 9: Memory Hierarchy Virtual Memory Kai Bu
Virtual Memory Expanding Memory Multiple Concurrent Processes.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
CS.305 Computer Architecture Memory: Virtual Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly made available.
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)
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
CS203 – Advanced Computer Architecture Virtual Memory.
Virtual Memory Chapter 8.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
CMSC 611: Advanced Computer Architecture
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
CSE 120 Principles of Operating
Lecture 12 Virtual Memory.
Memory Caches & TLB Virtual Memory
From Address Translation to Demand Paging
CS 704 Advanced Computer Architecture
Address Translation Mechanism of 80386
Memory Hierarchy Virtual Memory, Address Translation
CSE 153 Design of Operating Systems Winter 2018
Virtual Memory Chapter 8.
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Evolution in Memory Management Techniques
Chapter 5 Memory CSE 820.
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
CSE 451: Operating Systems Autumn 2005 Memory Management
Translation Buffers (TLB’s)
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Contents Memory types & memory hierarchy Virtual memory (VM)
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Translation Buffers (TLB’s)
CSC3050 – Computer Architecture
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 471 Autumn 1998 Virtual memory
CS703 - Advanced Operating Systems
Main Memory Background
CSE 153 Design of Operating Systems Winter 2019
Translation Buffers (TLBs)
Virtual Memory.
Synonyms v.p. x, process A v.p # index Map to same physical page
Review What are the advantages/disadvantages of pages versus segments?
Presentation transcript:

Virtual Memory Overcoming main memory size limitation Sharing of main memory among processes Virtual memory model Decoupling of Addresses used by the program (virtual) Memory addresses (physical) Physical memory allocation Pages Segments Process relocation Demand paging

Virtual/Physical Memory Mapping Physical addresses Virtual addresses Virtual memory Physical memory 0 – 1023 1024 – 2047 2048 – 3071 3072 - 4095 Page 0 MMU Page frame 0 0 – 1023 1024 – 2047 2048 – 3071 3072 – 4095 4096 – 5119 5120 – 6143 6144 - 7167 Page 1 Page frame 1 Page 2 Page frame 2 Page 3 Page frame 3 . . . Page frame 4 Process n Page frame 5 0 – 1023 1024 – 2047 2048 – 3071 3072 – 4095 4096 - 5119 Page 0 Page frame 6 Page 1 Page 2 Page 3 Page 4

Caches vs. Virtual Memory Quantitative differences Block (page) size Hit time Miss (page fault) penalty Miss (page fault) rate Size Replacement control Cache: hardware Virtual memory: OS Size of virtual address space = f(address size) Disks are also used for the file system

Paging vs. Segmentation Page Segment Address One word Two words Programmer visible? No Maybe Block replacement Trivial Hard Fragmentation Internal external Disk traffic Efficient Not efficient Hybrids: Paged segments Multiple page sizes

Design Elements Minimize page faults Block size Block placement Fully associative Block identification Page table Replacement Algorithm LRU Write Policy Write back

Page Tables Each process has one or more page tables Size of Page table (31-bit address, 4KB pages => 2MB) Two-level approach: 2 virtual-to-physical translations Inverted page tables Virtual address 00100 110011001110 1 2 3 4 001110011001 000 1 110110011011 xxx 001110000101 001 1 110000111100 101 1 001001000100 xxx 101 110011001110 Page# Disk address Present bit Page frame Physical address

Segmentation Visible to the programmer Multiple address spaces of variable size Segment table: start address and size Segment registers (x86) Advantages Simplifies handling of growing data structures Independent code segments VA: Segment Offset Compare Fault Size Segment table + PA:

Translation Buffer Fast address translation Principle of locality Cache for the page table Tag: portion of the virtual address Data: page frame number, protection field, valid, use, and dirty bit Virtual cache index and physical tags Address translation on the critical path Small TLB Pipelined TLB TLB misses

TLB and Cache Operation TBL Operation Virtual address Hit Page# Offset TLB Miss Cache Operation Real address Hit Tag Remainder Cache + Value Miss Main Memory Page Table Value

Page Size Large size Small size Smaller page tables Faster cache hit times Efficient page transfer Less TLB misses Small size Less internal fragmentation Process start-up time

Memory Protection Multiprogramming Base and bound registers Protection and sharing  Virtual memory Context switching Base and bound registers (Base + Address) <= Bound Hardware support Two execution modes: user and kernel Protect CPU state: base/bound registers, user/kernel mode bits, and the exception enable/disable bits System call mechanism

Protection and Virtual Memory During the virtual to physical mapping Check for errors or protection Add permission flags to each page/segment Read/write protection User/kernel protection Protection models Two-level model: user/kernel Protection rings Capabilities

Memory Hierarchy Design Issues Superscalar CPU and number of ports to the cache Multiple issue processors Non-blocking caches Speculative execution and conditional instructions Can generate invalid addresses (exceptions) and cache misses Memory system must identify speculative instructions and suppress the exceptions and cache stalls on a miss Compilers: ILP versus reducing cache misses for (i = 0; i < 512; i = i + 1) for (j = 0; j < 512; j = j + 1) x[i][j] = 2 * x[i][j-1]; I/O and cache data consistency

Cache and Memory coherent Coherency CPU CPU CPU A’ 100 200 A’ 500 200 A’ 100 200 Cache B’ B’ B’ 100 200 100 200 100 400 A A A Memory B B B I/O I/O Output A I/O Input A Cache and Memory coherent