Allocation of Frames Each process needs minimum number of pages

Slides:



Advertisements
Similar presentations
Page Replacement Algorithms
Advertisements

Virtual Memory (Chapter 4.3)
Module 10: Virtual Memory
Chapter 10: Virtual Memory
Page Replacement Algorithms (Virtual Memory)
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 9: Virtual Memory
Paging: Design Issues. Readings r Silbershatz et al: ,
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.
03/31/2004CSCI 315 Operating Systems Design1 Allocation of Frames & Thrashing (Virtual Memory)
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.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 15: Background Information for the VMWare ESX Memory Management.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
Module 9: Virtual Memory
Advanced Operating Systems - Spring 2009 Lecture 17 – March 23, 2009 Dan C. Marinescu Office: HEC 439 B. Office hours:
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
1 Thursday, July 06, 2006 “Experience is something you don't get until just after you need it.” - Olivier.
Chapter 9: Virtual-Memory Management. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 9: Virtual Memory Background Demand Paging.
Virtual Memory Background Demand Paging Performance of Demand Paging
Virtual Memory Introduction to Operating Systems: Module 9.
Segmentation and Paging Considerations
Gordon College Stephen Brinton
Memory Management Design & Implementation Segmentation Chapter 4.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Virtual Memory.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Chapter 9: Virtual Memory Background.
Chapter 10: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Chapter 10: Virtual Memory.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Revisiting Virtual Memory.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual Memory.
A. Frank - P. Weisberg Operating Systems Virtual Memory Policies.
03/29/2004CSCI 315 Operating Systems Design1 Page Replacement Algorithms (Virtual Memory)
Chapter 9: Virtual Memory. Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel.
CSS430 Virtual Memory Textbook Ch9
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Chapter 3 Memory Management: Virtual Memory
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.
Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel.
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.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory.
Operating Systems CMPSC 473 Virtual Memory Management (3) November – Lecture 20 Instructor: Bhuvan Urgaonkar.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Page Replacement Allocation of.
9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation.
#include pthread_mutex_t sem_mut = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t cond_mut = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
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.
CSC 360, Instructor: Kui Wu Memory Management II: Virtual Memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
9.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 9.5 Allocation of Frames Each process needs minimum number of pages Example: machine.
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.
NETW3005 Virtual Memory. Reading For this lecture, you should have read Chapter 9 (Sections 1-7). NETW3005 (Operating Systems) Lecture 08 - Virtual Memory2.
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.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
SLC/VER1.0/OS CONCEPTS/OCT'99
Chapter 9: Virtual Memory
Module 9: Virtual Memory
Chapter 9: Virtual Memory
What Happens if There is no Free Frame?
Lecture 40 Syed Mansoor Sarwar
5: Virtual Memory Background Demand Paging
Chapter 9: Virtual Memory
Operating Systems CMPSC 473
Lecture 41 Syed Mansoor Sarwar
Module 9: Virtual Memory
Chapter 9: Virtual Memory CSS503 Systems Programming
Presentation transcript:

Allocation of Frames Each process needs minimum number of pages Two major allocation schemes fixed allocation priority allocation

Fixed Allocation Equal allocation – For example, if there are 100 frames and 5 processes, give each process 20 frames. Proportional allocation – Allocate according to the size of process

Priority Allocation Use a proportional allocation scheme using priorities rather than size If process Pi generates a page fault, select for replacement one of its frames select for replacement a frame from a process with lower priority number

Global vs. Local Allocation Global replacement – process selects a replacement frame from the set of all frames; one process can take a frame from another Local replacement – each process selects from only its own set of allocated frames

Thrashing If a process does not have “enough” pages, the page-fault rate is very high. This leads to low CPU utilization Thrashing  a process is busy swapping pages in and out It may happen operating system thinks that it needs to increase the degree of multiprogramming another process added to the system

Thrashing

Thrashing  size of locality > total memory size Why does paging work? Locality model Process migrates from one locality to another Why does thrashing occur?  size of locality > total memory size

Dynamic Paging Algorithms Paging algorithms considered so far all assume that a process is allocated a fixed amount of memory when it is started and the amount does not change during the computation Static algorithms do not adjust the allocation of frames, even if the process passes through phases in which it requires a large physical address space or its memory requirements are modest A process changes locality as it executes. When the locality changes, not only do the identities of the pages change but also the number of pages in the locality is likely to change Sometimes the process needs only a few frames to hold the pages it is using, while at other times it needs many frames Dynamic paging algorithms adjust the memory allocation to match the process’s needs as they change

Working Set Model   working set window  a fixed number of page references (e.g., 10,000 instructions) WS(ti)  working set at time ti  pages referenced in the most recent  (up to ti) if  too small will not encompass entire locality if  too large will encompass several localities if  =   will encompass entire program

Working Set Model For any fixed value of , the working set size can vary over time For many programs, periods of relatively stable working set sizes alternate with periods of rapid change When a process first begins executing, it gradually builds up to a working set as it references new pages Eventually, by the principle of locality, the process should stabilize on a certain set of pages Subsequent transient periods reflect a shift of the program to a new locality

Working Set Model The OS monitors the working set of each process and allocates enough frames to provide it with its working set size If there are enough extra frames, another process can be initiated D =  |WS(ti)|  sum of working set sizes of all processes at ti  total demand frames if D > m  Thrashing Policy: if D > m, then suspend one of the processes This strategy prevents thrashing while keeping the degree of multiprogramming as high as possible. Thus, it optimizes CPU utilization

Example Given the following reference string: 0 1 2 3 0 1 2 3 0 1 2 3 4 5 6 7 (a) Determine WS(ti) with  = 3 (b) Determine WS(ti) with  = 4 (c) Determine WS(ti) with  = 9