1 Virtual Memory Chapter 9. 2 Resident Set Size n Fixed-allocation policy u Allocates a fixed number of frames that remains constant over time F The number.

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

Chapter 4 Memory Management Basic memory management Swapping
Chapter 3.3 : OS Policies for Virtual Memory
Virtual Memory 3 Fred Kuhns
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
Allocation of Frames Each process needs minimum number of pages
Operating Systems Prof. Navneet Goyal Department of Computer Science & Information Systems BITS, Pilani.
Page 15/4/2015 CSE 30341: Operating Systems Principles Allocation of Frames  How should the OS distribute the frames among the various processes?  Each.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 38 Frame Allocation Read.
Chapter 101 Cleaning Policy When should a modified page be written out to disk?  Demand cleaning write page out only when its frame has been selected.
CS623: Lecture 3 February 10, 2004 © Joel Wein 2003, modified by T. Suel.
Virtual Memory Background Demand Paging Performance of Demand Paging
Virtual Memory Introduction to Operating Systems: Module 9.
Segmentation and Paging Considerations
Virtual Memory Chapter 8.
Virtual Memory Chapter 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.
Module 3.1: Virtual Memory
Memory Management 2010.
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.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Revisiting Virtual Memory.
Virtual Memory Chapter 8.
Virtual Memory:Part 2 Kashyap Sheth Kishore Putta Bijal Shah Kshama Desai.
1 Virtual Memory Chapter 8. 2 Process Execution n The OS brings into main memory only a few pieces of the program (including its starting point) n Each.
OS Spring’04 Virtual Memory: Page Replacement Operating Systems Spring 2004.
A. Frank - P. Weisberg Operating Systems Virtual Memory Policies.
03/29/2004CSCI 315 Operating Systems Design1 Page Replacement Algorithms (Virtual Memory)
Virtual Memory Chapter 8.
Operating Systems ECE344 Ding Yuan Page Replacement Lecture 9: Page Replacement.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Page 19/17/2015 CSE 30341: Operating Systems Principles Optimal Algorithm  Replace page that will not be used for longest period of time  Used for measuring.
Module 8: Virtual Memory
Subject: Operating System.
Second-Chance Algorithm Basically, it’s a FIFO algorithm When a page has been selected, we inspect its reference bit. If the value is 0, we proceed to.
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.
Copyright ©: Lawrence Angrave, Vikram Adve, Caccamo 1 Virtual Memory.
1 Virtual Memory Chapter 8. 2 Virtual memory concept Simple paging/ segmentation  pages or segments are loaded into frames that may not necessarily be.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Page Replacement Allocation of.
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.
CSC 360, Instructor: Kui Wu Memory Management II: Virtual Memory.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
Page Buffering, I. Pages to be replaced are kept in main memory for a while to guard against poorly performing replacement algorithms such as FIFO Two.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
1 Page Replacement Algorithms. 2 Virtual Memory Management Fundamental issues : A Recap Key concept: Demand paging  Load pages into memory only when.
1 Module 8: Virtual Memory Reading: Chapter 9 Objectives:  To describe the benefits of a virtual memory system.  To explain the concepts of demand paging,
Virtual Memory Operating Systems 1 Computer Science Dept Va Tech August 2007 © McQuain Page Buffering LRU and the Clock Algorithm are generally.
Chapters 7 & 8 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Virtual Memory.
Virtual Memory Chapter 8.
Chapter 7 Memory Management
Day 23 Virtual Memory.
Day 24 Virtual Memory.
CSC 322 Operating Systems Concepts Lecture - 16: by
Chapter 8 Virtual Memory
Lecture 10: Virtual Memory
Module IV Memory Organization.
Virtual Memory Chapter 8.
Virtual Memory Chapter 8.
Lecture 41 Syed Mansoor Sarwar
Virtual Memory: Policies (Part II)
Operating Systems: Internals and Design Principles, 6/E
Presentation transcript:

1 Virtual Memory Chapter 9

2 Resident Set Size n Fixed-allocation policy u Allocates a fixed number of frames that remains constant over time F The number is determined at load time and depends on the type of the application n Variable-allocation policy u The number of frames allocated to a process may vary over time F May increase if page fault rate is high F May decrease if page fault rate is very low u Requires more OS overhead to assess behavior of active processes

3 Replacement Scope n Replacement scope determines the set of frames to be considered for replacement when a page fault occurs n Local replacement policy u Chooses only among the frames that are allocated to the process that issued the page fault n Global replacement policy u Any unlocked frame is a candidate for replacement n Let us consider the possible combinations of replacement scope and resident set size policy

4 Fixed allocation and Local scope n Each process is allocated a fixed number of pages u Determined at load time and depends on application type n When a page fault occurs, page frames considered for replacement are local to the page- fault process u The number of frames allocated is thus constant u Previous replacement algorithms can be used n Problem: difficult to determine ahead of time a good number for the allocated frames u If too low: page fault rate will be high u If too large: multiprogramming level will be low

5 Fixed allocation and Global scope n Impossible to achieve u If all unlocked frames are candidate for replacement, the number of frames allocated to a process will necessary vary over time

6 Variable Allocation and Global Scope n Simple to implement--adopted by many OS (like Unix SVR4) n A list of free frames is maintained u When a process issues a page fault, a free frame (from this list) is allocated to it u Hence the number of frames allocated to a page fault process increases u The choice for the process that will loose a frame is arbitrary: far from optimal n Page buffering can alleviate this problem since a page may be reclaimed if it is referenced again soon

7 Variable Allocation and Local Scope n May be the best combination (used by Windows NT) n Allocate at load time a certain number of frames to a new process based on application type u Use either pre-paging or demand paging to fill up the allocation n When a page fault occurs, select the page to replace from the resident set of the process that suffers the fault n Reevaluate periodically the allocation provided and increase or decrease it to improve overall performance

8 The Working Set Strategy n It is a variable-allocation method with local scope based on the assumption of locality of references n The working set for a process at time t, W(D,t), is the set of pages that have been referenced in the last D virtual time units u Virtual time = time elapsed while the process was in execution (eg: number of instructions executed) u D is a window of time u At any t, |W(D,t)| is non decreasing with D u W(D,t) is an approximation of the program’s locality

9 The Working Set Strategy n The working set of a process first grows when it starts executing then stabilizes by the principle of locality n It grows again when the process enters a new locality (transition period) u Up to a point where the working set contains pages from two localities n It then decreases after a sufficiently long time spent in the new locality

10 The Working Set Strategy n The working set concept suggests the following strategy to determine the resident set size: u Monitor the working set for each process u Periodically remove from the resident set of a process those pages that are not in the working set u When the resident set of a process is smaller than its working set, allocate more frames to it F If not enough free frames are available, suspend the process (until more frames are available) ie: a process may execute only if its working set is in main memory

11 The Working Set Strategy n Practical problems with this working set strategy u Measurement of the working set for each process is impractical F Necessary to time stamp the referenced page at every memory reference F Necessary to maintain a time-ordered queue of referenced pages for each process u The optimal value for D is unknown and varies with time n Solution: rather than monitor the working set, monitor the page fault rate!

12 The Page-Fault Frequency Strategy n Define an upper bound U and lower bound L for page fault rates n Allocate more frames to a process if fault rate is higher than U n Allocate less frames if fault rate is < L n The resident set size should be close to the working set size W n We suspend the process if the PFF > U and no more free frames are available

13 Load Control n A working set or page fault frequency algorithm implicitly incorporates load control u Only those processes whose resident set is sufficiently large are allowed to execute n Another approach is to adjust explicitly the multiprogramming level so that the mean time between page faults equals the time to process a page fault u Performance studies indicate that this is the point where processor usage is at maximum

14 Process Suspension n Explicit load control requires that we sometimes swap out (suspend) processes n Possible victim selection criteria: u Faulting process F This process may not have its working set in main memory so it will be blocked anyway u Last process activated F This process is least likely to have its working set resident u Process with smallest resident set F This process requires the least future effort to reload u Largest process F This yields the most free frames