Memory Management (2).

Slides:



Advertisements
Similar presentations
Chapter 4 Memory Management Basic memory management Swapping
Advertisements

Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Virtual Memory. 2 What is virtual memory? Each process has illusion of large address space –2 32 for 32-bit addressing However, physical memory is much.
1 Virtual Memory Management B.Ramamurthy. 2 Demand Paging Main memory LAS 0 LAS 1 LAS 2 (Physical Address Space -PAS) LAS - Logical Address.
9.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory OSC: Chapter 9. Demand Paging Copy-on-Write Page Replacement.
Virtual Memory Today Virtual memory Page replacement algorithms
Memory/Storage Architecture Lab Computer Architecture Virtual Memory.
03/26/2010CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying an earlier.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management -3 CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Lecture 11: Memory Management
1 Virtual Memory vs. Physical Memory So far, all of a job’s virtual address space must be in physical memory However, many parts of programs are never.
CS 104 Introduction to Computer Science and Graphics Problems
Introduction to Systems Programming Lecture 7
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
Virtual Memory  Early computers had a small and fixed amount to memory. All programs had to be able to fit in this memory. Overlays were used when the.
Operating System Machine Level  An operating system is a program that, from the programmer’s point of view, adds a variety of new instructions and features,
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.
Maninder Kaur VIRTUAL MEMORY 24-Nov
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Virtual Memory.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Seventh Edition William Stallings.
Virtual Memory Virtual Memory is created to solve difficult memory management problems Data fragmentation in physical memory: Reuses blocks of memory.
Virtual Memory. Background Virtual memory is a technique that allows execution of processes that may not be completely in the physical memory. Virtual.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Lecture Topics: 11/24 Sharing Pages Demand Paging (and alternative) Page Replacement –optimal algorithm –implementable algorithms.
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.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
Lecture 19 Virtual Memory Demand Paging. Background Virtual memory – separation of user logical memory from physical memory. –Only part of the program.
Virtual Memory The address used by a programmer will be called a virtual address or logical address. An address in main memory is called a physical address.
Saket Mengle Paging refers to the process of managing program access to virtual memory pages that do not currently reside in RAM.
1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples (not covered.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Virtual Memory. 2 Last Week Memory Management Increase degree of multiprogramming –Entire process needs to fit into memory Dynamic Linking and Loading.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
COS 318: Operating Systems Virtual Memory Paging.
CS 333 Introduction to Operating Systems Class 14 – Page Replacement
Memory Management Chapter 3
Computer Organization
ITEC 202 Operating Systems
Ramya Kandasamy CS 147 Section 3
Day 22 Virtual Memory.
Chapter 9: Virtual Memory
Lecture 10: Virtual Memory
Module 9: Virtual Memory
Lecture 28: Virtual Memory-Address Translation
EECE.4810/EECE.5730 Operating Systems
Page Replacement.
What Happens if There is no Free Frame?
Lecture 40 Syed Mansoor Sarwar
5: Virtual Memory Background Demand Paging
Memory Management.
Demand Paged Virtual Memory
Contents Memory types & memory hierarchy Virtual memory (VM)
Practical Session 8, Memory Management 2
Computer Architecture
Operating Systems Concepts
Module 9: Virtual Memory
Student : Yan Wang student ID:
Practical Session 9, Memory Management continues
Virtual Memory.
4.3 Virtual Memory.
CSE 542: Operating Systems
Module IV Memory Organization.
Presentation transcript:

Memory Management (2)

VIRTUAL MEMORY Problem : programs were too big to fit in the available memory Solution : 1. overlay (split the program into pieces) Swapping overlay done by system, however splitting the program has to done by the programmer 2. Virtual memory Basic idea : programs may exceed the amount of physical memory available for it Most virtual memory system use a technique called paging,

Paging Virtual addresses : program-generated addresses, it form Virtual address space. Memory Management Unit (MMU) : maps the virtual addresses onto the physical memory addresses

Paging Virtual address space is divided up into units called pages The corresponding units in the physical memory are called page frames Page fault / fault = happened if program tries to use an unmapped page. The operating system picks a little-used page frame and writes its contents back to the disk. It then fetches the page just referenced into the page frame just freed, changes the map, and restarts the trapped instruction.

MOV REG,0 0 (virtual address) Page 0 Frame 2 Physical address is 8192 MOV REG,20500 20 bytes from the start of virtual page 5 (virtual addresses 20480) Frame 3 Physical address = 12288+20 = 12308 MOV REG, 33000 – PAGE FAULT

Paging Virtual address consist of 2 part : page number p offset page d Page table = table for all processes in the memory

Virtual address 0 mapped to physical address 20 ((5 x 4) + 0).

Page Replacement Algorithm When a page fault occurs, the operating system has to choose a page to remove from memory to make room for the page that has to be brought in. Objective : Minimum page fault

Page Replacement Algorithm Random FIFO (First In First Out) Optimal LRU (Least Recently Used)

FIFO (First In First Out) Replace the oldest page Number of faults : 15

Optimal Replace the page that will not be used in the near future Impossible to implement because the operating system has no way of knowing when each of the pages will be referenced next.

LRU (Least Recently Used) Replace the page that is not recently used