CSI 400/500 Operating Systems Spring 2009 Lecture #9 – Paging and Segmentation in Virtual Memory Monday, March 2 nd and Wednesday, March 4 th, 2009.

Slides:



Advertisements
Similar presentations
Chapters 7 & 8 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Advertisements

Virtual Memory II Chapter 8.
§12.4 Static Paging Algorithms
Chapter 8 Virtual Memory
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Day 23 Virtual Memory. Operating system’s role in VM Hardware-support Use VM or not Use paging or segmentation or both Software domain Algorithms for.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Virtual Memory Chapter 8.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Lecture 11: Memory Management
Virtual Memory. Names, Virtual Addresses & Physical Addresses Source Program Absolute Module Name Space P i ’s Virtual Address Space P i ’s Virtual Address.
Virtual Memory Chapter 8.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Lecture 9: Virtual Memory Operating System I Spring 2007.
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.
Virtual Memory (Chapter 8) Memory Management is an intimate and complex interrelationship between processor hardware and operating system software. Paging.
1 Memory Management in Representative Operating Systems.
Week 7 February 17, 2004 Adrienne Noble. Important Dates Due Monday, Feb 23 Homework 7 Due Wednesday, Feb 25 Project 3 Due Friday, Feb 27 Homework 8.
Slide 12-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter Virtual Memory.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Operating Systems Chapter 8
MEMORY MANAGEMENT Presented By:- Lect. Puneet Gupta G.P.C.G. Patiala.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
© 2004, D. J. Foreman 1 Virtual Memory. © 2004, D. J. Foreman 2 Objectives  Avoid copy/restore entire address space  Avoid unusable holes in memory.
VIRTUAL MEMORY By Thi Nguyen. Motivation  In early time, the main memory was not large enough to store and execute complex program as higher level languages.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Virtual Memory Virtual Memory is created to solve difficult memory management problems Data fragmentation in physical memory: Reuses blocks of memory.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 9: Virtual-Memory Management.
Memory Management. Why memory management? n Processes need to be loaded in memory to execute n Multiprogramming n The task of subdividing the user area.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
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.
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
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.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Virtual Memory Operating Systems 1 Computer Science Dept Va Tech August 2007 © McQuain Page Buffering LRU and the Clock Algorithm are generally.
Project 4 Awards First Place Group 7 Samuel Bartlett Michael Phillips Norman Chen.
Virtual Memory Chapter 8.
CS 140 Lecture Notes: Virtual Memory
Computer Organization
Memory Management Virtual Memory.
Chapter 9: Virtual Memory – Part I
ITEC 202 Operating Systems
Day 22 Virtual Memory.
Operating Systems: A Modern Perspective, Chapter 12
Operating Systems: A Modern Perspective, Chapter 12
26 - File Systems.
Chapter 8 Virtual Memory
CSI 400/500 Operating Systems Spring 2009
Virtual Memory Chapter 8.
Lecture 10: Virtual Memory
CS 140 Lecture Notes: Virtual Memory
Chapter 9: Virtual-Memory Management
Computer Architecture
CS 140 Lecture Notes: Virtual Memory
Practical Session 8, Memory Management 2
CSC3050 – Computer Architecture
Computer Architecture
CS 140 Lecture Notes: Virtual Memory
Operating Systems Concepts
COMP755 Advanced Operating Systems
Student : Yan Wang student ID:
Practical Session 9, Memory Management continues
Presentation transcript:

CSI 400/500 Operating Systems Spring 2009 Lecture #9 – Paging and Segmentation in Virtual Memory Monday, March 2 nd and Wednesday, March 4 th, 2009

2 Virtual Memory  Not physical  Concept of “extending” primary memory by having an address refer to a piece of secondary storage loaded into primary storage  Saves data-loading time and saves storage space

3 Virtual Memory Allocation  Means of using storage to hold address space portions of all processes in system  Two basic methods:  Paging  Segmentation

4 Virtual Paging  Fixed size block  Entire address space divided into pages  Subset of pages loaded into primary storage at a time  Primary storage block of same size called “page frame”

5 Page Allocation  Operating System maintains Page Table  Holds start address of all loaded pages  Data is referenced by translating virtual address  Virtual address contains index into page table and offset within page where specific data is located

6 Page Translation

7 Paging Algorithmic Policies  Fetch  Placement  Replacement  Determines when to load page into primary storage  Determines where to place loaded page  Determines when and how to remove a page to make room for new page (necessary when all page slots are full)

8 Fetch Policies  Prefetch  Obtain page prior to execution  Needs to know first data references  Demand  Load page when data requested  Dynamic  # of pages varies during execution

9 Placement Policies  Contiguous  Pages are loaded in contiguous storage  Reuse  Frames that held pages that have been removed will be reused, in order of removal  References a free space chain (FIFO)

10 Replacement Policies  Random  Not preferred – not efficient  Least Recently Used  Least Frequently Used  FIFO  Optimal  Clock  We’ll discuss this a bit later

11 Replacement Example  Suppose 8-page working set  Following pages have been accessed # of times: 0 – 51 – 32 – 63 – 4 4 – 25 – 36 – 17 – 2 using references 0,1,2,3,4,2,0,5,3,6,0,2,1,7,2,3,5,0,4,1,2,7,0,5,3,2  Consider the following page references: 8,0,2,7,9,6,3,4,2,5,1  What happens with LRU, LFU, and FIFO?

12 Paging Performance Measures  Fault rate: frequency of loads (when a data value has no virtual address)  Loads occur at beginning and with each replacement  Transfer time: time to write changed code back and load new page  Shortened by replacing non-edited page  Clock replacement deals with this concept

13 Clock Replacement  Two flags per page frame: referenced and changed  Replacement pointer moves along page frames in consecutive order  Looking for 1 st page with both flags off  Replaces that page and moves pointer forward  As finds changed pages, saves changes and clears both flags, then moves pointer forward  If no page frame found with both flags off, uses 1 st referenced but not changed page

14 Dynamic Paging  Processes can have different number of pages allocated at any times  Varies based upon computational needs  Demands each process define a “working set”  Number of pages needed at particular time  Handled by user-specified parameters (like BUFFERS or PAGESIZE) or by compiler optimization  Process held until additional pages are loaded

15 Segmentation  Variable sized  Allocated dynamically  Segments placed in contiguous storage  Method used to allocate system stacks

16 Segment Allocation  Operating System maintains Segment Table  Contains starting address and length of all segments  Data is referenced by translating virtual address  Virtual address contains index into segment table, offset within segment where specific data is located, and size of data  Size is needed to ensure it does not exceed boundary

17 Segment Translation index offset length address length Data OK?

18 Linux Virtual Addressing  Uses dynamic on-demand paging  Uses triple page translation scheme  1 st part of virtual address is index into page directory  2 nd part is index in page middle directory, whose address was obtained from page directory entry  3 rd part is index into page table, whose address was obtained from middle directory entry  Last part is offset into page

19 Linux Page Translation Data index page Offset directory address