The Memory Hierarchy Lecture 31 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir.

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.
Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
COMP381 by M. Hamdi 1 Virtual Memory. COMP381 by M. Hamdi 2 Virtual Memory: The Problem For example: MIPS64 is a 64-bit architecture allowing an address.
Virtual Memory main memory can act as a cache for secondary storage motivation: Allow programs to use more memory that there is available transparent to.
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
CSC 4250 Computer Architectures December 8, 2006 Chapter 5. Memory Hierarchy.
The Memory Hierarchy (Lectures #24) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer Organization.
1 Lecture 20: Cache Hierarchies, Virtual Memory Today’s topics:  Cache hierarchies  Virtual memory Reminder:  Assignment 8 will be posted soon (due.
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
1 Lecture 20 – Caching and Virtual Memory  2004 Morgan Kaufmann Publishers Lecture 20 Caches and Virtual Memory.
Technical University of Lodz Department of Microelectronics and Computer Science Elements of high performance microprocessor architecture Virtual memory.
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
1  1998 Morgan Kaufmann Publishers Chapter Seven Large and Fast: Exploiting Memory Hierarchy (Part II)
CSCI2413 Lecture 6 Operating Systems Memory Management 2 phones off (please)
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
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.
Lecture 33: Chapter 5 Today’s topic –Cache Replacement Algorithms –Multi-level Caches –Virtual Memories 1.
CSE378 Virtual memory.1 Evolution in memory management techniques In early days, single program ran on the whole machine –used all the memory available.
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Operating Systems Chapter 8
Computer Architecture Lecture 28 Fasih ur Rehman.
Lecture 19: Virtual Memory
1  2004 Morgan Kaufmann Publishers Multilevel cache Used to reduce miss penalty to main memory First level designed –to reduce hit time –to be of small.
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
The Memory Hierarchy 21/05/2009Lecture 32_CA&O_Engr Umbreen Sabir.
Lecture 9: Memory Hierarchy Virtual Memory Kai Bu
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP 203 / NWEN 201 Computer Organisation / Computer Architectures Virtual.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
1 Linux Operating System 許 富 皓. 2 Memory Addressing.
Virtual Memory. DRAM as cache What about programs larger than DRAM? When we run multiple programs, all must fit in DRAM! Add another larger, slower level.
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.
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
1 Some Real Problem  What if a program needs more memory than the machine has? —even if individual programs fit in memory, how can we run multiple programs?
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
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.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
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)
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”
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.
CS203 – Advanced Computer Architecture Virtual Memory.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
CMSC 611: Advanced Computer Architecture Memory & Virtual Memory Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material.
CS161 – Design and Architecture of Computer
Virtual Memory Chapter 7.4.
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Lecture 12 Virtual Memory.
Section 9: Virtual Memory (VM)
CS 704 Advanced Computer Architecture
Some Real Problem What if a program needs more memory than the machine has? even if individual programs fit in memory, how can we run multiple programs?
Lecture 28: Virtual Memory-Address Translation
CSCI206 - Computer Organization & Programming
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Contents Memory types & memory hierarchy Virtual memory (VM)
Virtual Memory.
4.3 Virtual Memory.
Memory Management & Virtual Memory
Presentation transcript:

The Memory Hierarchy Lecture 31 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir

Virtual Memory  When multiple applications (processes) run at the same time, the main memory (DRAM) becomes too small  Virtual memory extends the memory hierarchy to the hard disk, and treats the RAM as “cache” for the hard disk.  This way each process is allocated a portion of the RAM, and each program has its own range of physical memory addresses  Virtual memory “translates” (maps) the virtual addresses of each program to physical addresses in main memory  Protections have to be in place in case of data sharing. 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir

DRAM Virtual Memory  The CPU generates virtual addresses and memory is accessed by physical addresses  The memory is treated as fully-associative cache, and divided into pages  Translation eliminates the need to find a contiguous block of memory to allocate to a program. page Shared memory 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir

Virtual Memory - continued  The translation mechanism maps the CPU 32-bit address to the real physical address using a virtual page number and a page offset  Virtual address space is much larger than physical address space (2 20 vs ) 4 GB vs. 1 GB RAM - illusion of infinite memory 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir

Virtual Memory - continued  The number of page offset bits determines the page size – typically 4 KB to 16 KB) - should be large enough to reduce the chances of page fault  When there is a page fault - millions of clock cycles as penalty - it is treated in software through the exception mechanism.  Software can reduce page faults by cleverly deciding which pages to replace in DRAM (older pages)  Pages always exist on the hard disk, but are loaded into DRAM only when needed.  A write-back mechanism insures that pages that were altered (written into in RAM) are saved on disk before being discarded. 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir

Virtual Memory - continued  The translation mechanism is provided by a page table  Each program has its own page table which contains the physical addresses of the pages and is indexed by the virtual page number.  Each program when it has possession of the CPU has its pointer to the page table loaded by the OS and its page table is read  Since each process has its own page table, programs can have same virtual address space because the page table will have different mappings for different programs (protection) 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir

Page Table The size of the page table has to be limited, such that no one process gobbles up the whole physical memory Pointer to the location of the first address of the page table of the active process Valid bit indicates if the page is in DRAM The page table of a process is not fixed- it is altered by the OS to assure different processes do not collide and in case of page faults 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir

Page Faults  If the Valid Bit is 0 - Page fault - the address points to a page on the hard disk  The page needs to be loaded in DRAM by the OS and the page table written to change the mapping to a new address in physical memory and turn the Valid Bit to 1  If physical memory is full, an existing page needs to be discarded before a new page is loaded from disk  OS uses least-recently used scheme  It uses a reference bit for each physical page set whenever that page is accessed. OS looks at it, while also periodically resets this bit (a statistical LRU)  A dirty bit is added to the page table to indicate if the page was altered - if yes it needs to be saved before being discarded 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir