Day 22 Virtual Memory.

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

CS 241 Spring 2007 System Programming 1 Memory Replacement Policies Lecture 32 Klara Nahrstedt.
4.4 Page replacement algorithms
Page Replacement Algorithms
Chapter 101 The LRU Policy Replaces the page that has not been referenced for the longest time in the past By the principle of locality, this would be.
Chapter 3.3 : OS Policies for Virtual Memory
Virtual Memory 3 Fred Kuhns
Page-replacement policies On some standard algorithms for the management of resident virtual memory pages.
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Virtual Memory II Chapter 8.
Virtual Memory: Page Replacement
Chapter 8 Virtual Memory
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice.
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.
Memory/Storage Architecture Lab Computer Architecture Virtual Memory.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Virtual Memory Chapter 8.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management – 4 Page Replacement Algorithms CS 342 – Operating Systems.
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
1 Virtual Memory Chapter 9. 2 Characteristics of Paging and Segmentation n Memory references are dynamically translated into physical addresses at run.
Chapter 11 – Virtual Memory Management Outline 11.1 Introduction 11.2Locality 11.3Demand Paging 11.4Anticipatory Paging 11.5Page Replacement 11.6Page Replacement.
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.
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.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
Chapter 8 Virtual Memory
OS Spring’04 Virtual Memory: Page Replacement Operating Systems Spring 2004.
Virtual Memory Management
Virtual Memory Chapter 8. Characteristics of Paging and Segmentation A process may be broken up into pieces (pages or segments) that do not need to be.
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.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Seventh Edition William Stallings.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Paging.
1 Virtual Memory Chapter 8. 2 Virtual memory concept Simple paging/ segmentation  pages or segments are loaded into frames that may not necessarily be.
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.
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 Virtual Memory. Cache memory: provides illusion of very high speed Virtual memory: provides illusion of very large size Main memory: reasonable cost,
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.
1 Page Replacement Algorithms. 2 Virtual Memory Management Fundamental issues : A Recap Key concept: Demand paging  Load pages into memory only when.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
Virtual Memory. 2 Last Week Memory Management Increase degree of multiprogramming –Entire process needs to fit into memory Dynamic Linking and Loading.
PAGE REPLACEMNT ALGORITHMS FUNDAMENTAL OF ALGORITHMS.
Project 4 Awards First Place Group 7 Samuel Bartlett Michael Phillips Norman Chen.
Virtual Memory Chapter 8.
Memory Management (2).
ITEC 202 Operating Systems
Day 23 Virtual Memory.
Day 24 Virtual Memory.
Chapter 8 Virtual Memory
Virtual Memory Chapter 8.
Lecture 10: Virtual Memory
Chapter 9: Virtual-Memory Management
Virtual Memory فصل هشتم.
COT 4600 Operating Systems Spring 2011
Contents Memory types & memory hierarchy Virtual memory (VM)
Practical Session 8, Memory Management 2
Computer Architecture
Operating Systems CMPSC 473
Virtual Memory: Policies (Part II)
Operating Systems Concepts
COMP755 Advanced Operating Systems
Practical Session 9, Memory Management continues
CGS 3763 Operating Systems Concepts Spring 2013
Presentation transcript:

Day 22 Virtual Memory

Operating system’s role in VM Hardware-support Use VM or not Use paging or segmentation or both Software domain Algorithms for memory management Aim is to minimize page faults No optimum strategy Depends on main memory size, # of processes, relative speed of main memory and secondary memory, size of processes and the behavior of individual processes.

Algorithms for: Fetch policy Placement Policy Replacement policy Resident Set Management Cleaning policy Load Control

Fetch policy When should a page be loaded in to memory Demand paging When a reference is made to a location in the page Pre-paging Load the page referenced as well as the “n” neighboring pages Exploits the characteristics of most secondary devices. If the pages of a process are stored in contiguous locations, then it may be effective.

Placement Where to place a portion. With segments, use best-fit, first-fit etc to minimize external fragmentation. With paging or paging combined with segmentation, this is not an issue. Any available frame can be used.

Which page to replace Resident set management Replacement policy How many pages per process in main memory When bringing in a new page, should the page being replaced be that of the process that caused the page fault or could it belong to any process Replacement policy Among the pages eligible to be replaced, which one should be replaced to keep the page faults at a minimum. Page to be replaced must be the one least likely to be replaced in the immediate future

Which page? Optimal – Page for which the time to the next reference is longest Impossible to implement as must know what will happen in the future. Least recently used – Page that has not been referenced in the longest time Difficulty in maintaining the information as to when each page was last referenced.

Which page? First-in-first-out Memory frames are treated as a circular buffer. Keeping a pointer to page that has been in memory the longest. Replace the page that has been in memory the longest and advance the pointer to the next frame.

Which page? – Clock policy Every frame has a use bit. It is set to 1, when the page is first brought in. The use bit is set to 1 every time the page is referenced. A pointer is used to point to the page after the one that was just replaced in the circular buffer(like in FIFO). When a page fault occurs: Start at pointer and scan the use bits of each frame. If use bit = 1, set to zero. If use bit = 0, then replace the frame. Update pointer to next frame. If all the frames have bit set to one, then pointer will go one complete circle and the first page will be replaced (FIFO) Otherwise, it is like LRU – replacing the page that has been least recently accessed.

u (use bit), m (modify bit). Variant to the simple clock policy – make more powerful by increasing the # of bits. u (use bit), m (modify bit). Not accessed recently, not modified (u=0,m=0) Not accessed recently, modified (u=0,m=1) Accessed recently, not modified (u=1,m=0) Access recently, modified recently (u=1,m=1) Replace pages that have not been used recently else not modified.

Step 1: Starting at pointer, replace page that has u=0, m=0 Step 2: Starting at pointer, replace page that has u=0, m=1. Also, set all u=1 to u=0 Step 3: Repeat 1 and/or 2.