Memory Management & Virtual Memory

Slides:



Advertisements
Similar presentations
Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
Advertisements

CSIE30300 Computer Architecture Unit 10: Virtual Memory Hsin-Chou Chi [Adapted from material by and
Virtual Memory Hardware Support
1 Memory Systems Virtual Memory Lecture 25 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
1 Lecture 20: Cache Hierarchies, Virtual Memory Today’s topics:  Cache hierarchies  Virtual memory Reminder:  Assignment 8 will be posted soon (due.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
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.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Memory Organization.
Virtual Memory. Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Memory: Virtual MemoryCSCE430/830 Memory Hierarchy: Virtual Memory CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng Zhu.
Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.
Virtual Memory Chantha Thoeun. Overview  Purpose:  Use the hard disk as an extension of RAM.  Increase the available address space of a process. 
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
The Memory Hierarchy 21/05/2009Lecture 32_CA&O_Engr Umbreen Sabir.
IT253: Computer Organization
Memory and cache CPU Memory I/O. CEG 320/52010: Memory and cache2 The Memory Hierarchy Registers Primary cache Secondary cache Main memory Magnetic disk.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
The Three C’s of Misses 7.5 Compulsory Misses The first time a memory location is accessed, it is always a miss Also known as cold-start misses Only way.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Chapter 91 Logical Address in Paging  Page size always chosen as a power of 2.  Example: if 16 bit addresses are used and page size = 1K, we need 10.
Operating Systems Unit 7: – Virtual Memory organization Operating Systems.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.
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)
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
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”
Computer Performance. Hard Drive - HDD Stores your files, programs, and information. If it gets full, you can’t save any more. Measured in bytes (KB,
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
3/1/2002CSE Virtual Memory Virtual Memory CPU On-chip cache Off-chip cache DRAM memory Disk memory Note: Some of the material in this lecture are.
The Memory Hierarchy Lecture 31 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir.
Memory Management & Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
CS161 – Design and Architecture of Computer
VIRTUAL MEMORY.
Lecture 11 Virtual Memory
Vivek Seshadri 15740/18740 Computer Architecture
Virtual Memory Chapter 7.4.
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Memory and cache CPU Memory I/O.
Lecture 12 Virtual Memory.
Section 9: Virtual Memory (VM)
Virtual Memory User memory model so far:
Memory Hierarchy Virtual Memory, Address Translation
CS510 Operating System Foundations
CS 286: Memory Paging and Virtual Memory
Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?
CSCI206 - Computer Organization & Programming
Lecture 21: Memory Hierarchy
Chapter 8 Digital Design and Computer Architecture: ARM® Edition
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Memory and cache CPU Memory I/O.
Lecture 23: Cache, Memory, Virtual Memory
FIGURE 12-1 Memory Hierarchy
Computer Architecture
What is trying to solve any virtual memory implementation ?
Lecture 22: Cache Hierarchies, Memory
CPSC 457 Operating Systems
Chap. 12 Memory Organization
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Computer System Design Lecture 11
Lecture 23: Virtual Memory, Multiprocessors
Lecture 13: Cache Basics Topics: terminology, cache organization (Sections )
4.3 Virtual Memory.
Presentation transcript:

Memory Management & Virtual Memory

Hierarchy Cache Memory : Provide invisible speedup to main memory

Hierarchy Virtual Memory : Provide invisible extension to main memory

Terminology Virtual/Logical Address : Physical Address : Page : Address program uses Size determined by bits in memory address Physical Address : Determined by available memory Page : Block of memory 4KB+ in Windows/Linux

Memory Management Memory Management Turns Virtual addresses used by processor into Physical addresses in memory

Virtual Memory How Why? Logical space can be independent of physical space Programs don't have to care how many GB ram you have

Virtual Memory Why? Allow programs to use more main memory than is physically present Hard drive used as extra space

Virtual Memory How Why? Allows multiple programs to coexist

Virtual Memory How Why? Allows multiple programs to coexist Everyone can use same logical addresses

Virtual Memory How Why? Allows multiple programs to coexist invisibly Some memory can be shared by processes

Virtual Memory How Why? Allows multiple programs to coexist invisibly Memory Management Unit can prevent access to unowned memory

Terminology Page Table : stores physical address of every page Paging : copying page from hard drive to RAM Page Fault : accessing a virtual page not in RAM

Example Assume each page is 4KB (4096 bytes) 32KB Virtual space, 12KB Physical

Example Assume each page is 4KB (4096 bytes) CPU asks for address 100 100 bytes into page 0

Example Assume each page is 4KB (4096 bytes) CPU asks for address 100 100 bytes into page 0 Virtual page 0 is in Physical Page 2

Example Assume each page is 4KB (4096 bytes) CPU asks for address 100 100 bytes into page 0 Virtual page 0 is in Physical Page 2 Physical address is 4K * 2 + 100

Example 2 Assume each page is 4KB (4096 bytes) CPU asks for address 4296 200 bytes into page 1

Example 2 Assume each page is 4KB (4096 bytes) CPU asks for address 4296 200 bytes into page 1 Not in physical memory Page Fault

Example 2 Assume each page is 4KB (4096 bytes) CPU asks for address 4296 200 bytes into page 1 Kick a page out to drive

Example 2 Assume each page is 4KB (4096 bytes) CPU asks for address 4296 200 bytes into page 1 Load desired virtual page into physical memory Update Page Table 3

Example 2 Assume each page is 4KB (4096 bytes) CPU asks for address 4296 200 bytes into page 1 Virtual page 1 is now in Physical Page 3 Physical address is 4K * 3 + 200 3

Page Faults Page Fault = 40,000,000 cycles with HDD! 600,000 with SSD

Page Sizes Small page size More book keeping More physical pages Less thrashing

Page Sizes Large page size Less book keeping More temporal locality If we use it all Fewer physical pages More thrashing

Page Mapping Memory addresses broken into Page Offset : Enough bits to specify every address in page Page # : All the rest

Page Mapping Computer has 32 bit address space, 1GB of physical memory and 4KB pages 1GB = 230 Physical address need 30 bits

Page Mapping Computer has 32 bit address space, 1GB of physical memory and 4KB pages Pages are 212 bytes 12 bits for offset

Page Mapping Computer has 32 bit address space, 1GB of physical memory and 4KB pages Pages are 212 bytes 12 bits for offset Virtual page number = 32 – 12 = 20 bits

Page Mapping Computer has 32 bit address space, 1GB of physical memory and 4KB pages Pages are 212 bytes 12 bits for offset Virtual page number = 32 – 12 = 20 bits Physical page number = 30 – 12 = 18 bits

Process Need logical address 0000 0111 0000 1010 0011 0010 1111 0100

Process Find virtual page # and offset in page 0000 0111 0000 1010 0011 0010 1111 0100 0000 0111 0000 1010 0011 0010 1111 0100

Process Find virtual page # and offset in page 0000 0111 0000 1010 0011 0010 1111 0100 Look up in page table… 0010 1111 0100 0000 0111 0000 1010 0011

Process Find virtual page # and offset in page 0000 0111 0000 1010 0011 0010 1111 0100 Look up in page table… Get physical page # 0010 1111 0100 0000 0111 0000 1010 0011 00 0010 1111 1111 0000

Process Find virtual page # and offset in page 0000 0111 0000 1010 0011 0010 1111 0100 Look up in page table… Get physical page # Combine with offset to make physical address 0010 1111 0100 0000 0111 0000 1010 0011 00 0010 1111 1111 0000 00 0010 1111 1111 0000 0010 1111 0100

Paging & Caching Page table held in main memory by OS

Paging & Caching Page table held in main memory by OS Every mapping goes to main memory… Cache is worthless!

TLB Translation look-aside buffer Cache for page table Subset of page table Fully associative May be multiple levels