Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.

Slides:



Advertisements
Similar presentations
C SINGH, JUNE 7-8, 2010IWW 2010, ISATANBUL, TURKEY Advanced Computers Architecture, UNIT 2 Advanced Computers Architecture UNIT 2 CACHE MEOMORY Lecture7.
Advertisements

MEMORY popo.
Chapter 4 Memory Management Basic memory management Swapping
1 Memory hierarchy and paging Electronic Computers M.
1 Lecture 13: Cache and Virtual Memroy Review Cache optimization approaches, cache miss classification, Adapted from UCB CS252 S01.
Memory Management: Overlays and Virtual Memory
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
CSC 4250 Computer Architectures December 8, 2006 Chapter 5. Memory Hierarchy.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Virtual Memory Chapter 8.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
Computer ArchitectureFall 2008 © CS : Computer Architecture Lecture 22 Virtual Memory (1) November 6, 2008 Nael Abu-Ghazaleh.
CS 104 Introduction to Computer Science and Graphics Problems
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Virtual Memory Chapter 8.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
Virtual Memory BY JEMINI ISLAM. What is Virtual Memory Virtual memory is a memory management system that gives a computer the appearance of having more.
Virtual Memory Topics Virtual Memory Access Page Table, TLB Programming for locality Memory Mountain Revisited.
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
VIRTUAL MEMORY. Virtual memory technique is used to extents the size of physical memory When a program does not completely fit into the main memory, it.
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.
Systems I Locality and Caching
Memory Systems Architecture and Hierarchical Memory Systems
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Computer Architecture Lecture 28 Fasih ur Rehman.
Lecture 19: Virtual Memory
IT253: Computer Organization
1 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms.
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.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
1  1998 Morgan Kaufmann Publishers Recap: Memory Hierarchy of a Modern Computer System By taking advantage of the principle of locality: –Present the.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Virtual Memory 1 1.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
Virtual Memory.  Next in memory hierarchy  Motivations:  to remove programming burdens of a small, limited amount of main memory  to allow efficient.
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.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Jeffrey Ellak CS 147. Topics What is memory hierarchy? What are the different types of memory? What is in charge of accessing memory?
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”
The Memory Hierarchy Lecture 31 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
Virtual Memory Chapter 8.
CS161 – Design and Architecture of Computer
Memory Hierarchy Ideal memory is fast, large, and inexpensive
Computer Organization
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Memory and cache CPU Memory I/O.
Lecture 12 Virtual Memory.
Ramya Kandasamy CS 147 Section 3
Local secondary storage (local disks)
Virtual Memory Chapter 8.
CSCI206 - Computer Organization & Programming
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
MEMORY MANAGEMENT & their issues
Memory and cache CPU Memory I/O.
ECE 445 – Computer Organization
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Virtual Memory Overcoming main memory size limitation
Contents Memory types & memory hierarchy Virtual memory (VM)
CSE451 Virtual Memory Paging Autumn 2002
Cache Memory and Performance
4.3 Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory – cache some medium-speed, medium price main memory gigabytes of slow, cheap disk storage Memory manager handles the memory hierarchy

Disk-based storage in computers Memory/storage hierarchy Combining many technologies to balance costs/benefits Recall the memory hierarchy and virtual memory lectures

Memory/storage hierarchies Balancing performance with cost Small memories are fast but expensive Large memories are slow but cheap Exploit locality to get the best of both worlds locality = re-use/nearness of accesses allows most accesses to use small, fast memory Capacity Performance

Computer Memory Hierarchy

An Example Memory Hierarchy registers on-chip L1 cache (SRAM) main memory (DRAM) local secondary storage (local disks) Larger, slower, and cheaper (per byte) storage devices remote secondary storage (tapes, distributed file systems, Web servers) Local disks hold files retrieved from disks on remote network servers. Main memory holds disk blocks retrieved from local disks. off-chip L2 cache (SRAM) L1 cache holds cache lines retrieved from the L2 cache memory. CPU registers hold words retrieved from L1 cache. L2 cache holds cache lines retrieved from main memory. L0: L1: L2: L3: L4: L5: Smaller, faster, and costlier (per byte) storage devices

7 Memory Management Virtual (or logical) address vs. Physical address Memory Management Unit (MMU) Set of registers and mechanisms to translate virtual addresses to physical addresses Processes (and CPU) see virtual addresses Virtual address space is same for all processes, usually 0 based Virtual spaces are protected from other processes MMU and devices see physical addresses CPU MMU MemoryI/O Devices Logical Addresses Physical Addresses

Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a very large range of memory or storage addresses for stored data. The computing system maps the programmer's virtual addresses to real hardware storage addresses (Hard Disks). In addition to managing the mapping of virtual storage addresses to real storage addresses, a computer implementing virtual memory or storage also manages storage swapping between active storage (RAM) and hard disk or other high volume storage devices

Virtual Memory Virtual memory is a feature of an operating system (OS) that allows a computer to compensate for shortages of physical memory by temporarily transferring pages of data from random access memory (RAM) to disk storage.

 All modern general-purpose computer operating systems use virtual memory techniques for ordinary applications, such as word processors, spreadsheets, multimedia players, accounting, etc  Older operating systems, such as DOS of the 1980s, or many mainframe operating systems of the 1960s, had no virtual memory functionality.  Embedded Systems and other special-purpose computer systems which require very fast, very consistent response time do not generally use virtual memory.

Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time A process may be swapped in and out of main memory such that it occupies different regions A process may be broken up into pieces that do not need to located contiguously in main memory All pieces of a process do not need to be loaded in main memory during execution 11

How Does it Work? Memory Management Unit (MMU) Hardware component responsible for handling accesses to memory requested by the (CPU). One of Its functions include translation of virtual addresses to physical addresses (Virtual Memory management),

Virtual memory Virtual Memory provides expansion of Main Memory by ‘overflowing’ data and program code onto Magnetic Disk. The area on disk reserved for this purpose is known as the Swap Space Dividing main memory into Frames (pages)

Pages The RAM physical memory subdivided into 4kb-64kb pages. 512MB/4K = pg Page Table provides a look up whereby the logical page number can be exchanged for the physical frame number. It is an Array of (PTE).

Process Process When programs are using the CPU at the same time, each running program and the data structures needed to manage it. Addresses Addresses A Load Instruction A Store Instruction Fetching an Instruction

Virtual Memory Address Translation Maximum Virtual Address space: Size of a program address is determined by the maximum size of the virtual address space. The number of bits in a virtual address is the log base 2 (log 2 ) of this value. Maximum Physical Address space: The amount of real memory that the system can support determined the number of bits needed to address the physical memory. The size of physical address is log base 2 (log 2 ) of this value. Size of a Page: This is the size of a virtual memory page and a physical memory frame. It is always a power of 2 (2 x )

Page number and page offset A virtual address is therefore split into two parts. The more significant part gives the page number. The less significant part gives the address of the byte within the page. The less significant part is also called the “page offset.” The number of bits allocated to the page offset should be able to address every byte in the page. Therefore, in our example. Since we have 4 KB = 2 12 byte page tables, we need 12 bits for page offset. Likewise for the physical address.

Virtual Address can be represented as: 13 bits 10 bits page number offset Physical Address can be represented as: 13 bits 10 bits Frame address offset

Page Fault The memory manager locates the missing page in secondary memory. The page is loaded into primary memory, usually causing another page to be unloaded. The page table in the memory manager is adjusted to reflect the new state of the memory. The processor re-executes the instructions which caused the page fault.

Translation Look-aside Buffer The TLB tends to be fully associative. The TLB uses write-back. Therefore, needs a dirty bit to indicate if the page is dirty Or have a Read or Write Permission bit This is because a TLB miss is very costly, and is to be avoided.

MEMORY PERFORMANCE COMPARISON

Page Replacement Policies: 3 major page replacement policies:  FIFO  LRU  OPT

FIFO FIFO(first in first out) : With FIFO, the oldest page in memory is selected for replacement Example: *2*22555 *5* *2*

LRU: (least recently used) LRU Policy- a policy that selects the page that has gone unused for the longest period of time *2*215 *2*24 *5*532 *5*5 *2*

OPT(optimal replacement policy) In this policy we will replace the memory with the page address which we will not use in the near future.

How to Access the Virtual Memory in your Computer? 1

2 3

4RAM Virtual Mem. 1GB 1536MB 2048MB 2GB3072MB4096MB 3GB4644MB6144MB