Day 24 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

4.4 Page replacement algorithms
Page Replacement Algorithms
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
Paging: Design Issues. Readings r Silbershatz et al: ,
Chapter 8 Virtual Memory
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
Module 9: Virtual Memory
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
Virtual Memory Background Demand Paging Performance of Demand Paging
Virtual Memory Introduction to Operating Systems: Module 9.
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 Management Design & Implementation Segmentation Chapter 4.
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.
1 Virtual Memory Chapter 9. 2 Characteristics of Paging and Segmentation n Memory references are dynamically translated into physical addresses at run.
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.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Revisiting Virtual Memory.
Computer Organization and Architecture
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.
Chapter 8 Virtual Memory
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)
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
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.
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 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. 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.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
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.
1 Page Replacement Algorithms. 2 Virtual Memory Management Fundamental issues : A Recap Key concept: Demand paging  Load pages into memory only when.
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.
Memory Management.
ITEC 202 Operating Systems
Day 22 Virtual Memory.
Day 23 Virtual Memory.
William Stallings Computer Organization and Architecture
Chapter 8 Virtual Memory
Virtual Memory Management
Module 9: Virtual Memory
Virtual Memory Chapter 8.
Lecture 40 Syed Mansoor Sarwar
5: Virtual Memory Background Demand Paging
Operating Systems.
Chapter 4: Memory Management
Virtual Memory Chapter 8.
Operating Systems CMPSC 473
Virtual Memory: Policies (Part II)
Operating Systems Concepts
Module 9: Virtual Memory
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Chapter 9: Virtual Memory CSS503 Systems Programming
Presentation transcript:

Day 24 Virtual Memory

Page buffering A page that is to be replaced remains in memory for some more time Will not require a disk access if it is needed in the immediate future. Alleviates the problem of an inaccurate page replacement decision A list of modified pages is maintained, so when writing back to disk, can write all the modified pages together. Used along with a simple page replacement scheme such as FIFO.

Page buffering A few frames are not allotted to any process. When a page is to be replaced, its page table entry is added to one of two lists: Free page list, if page not modified Modified page list, if page modified When a new page is brought in, it is placed in the frame vacated by the page whose page table entry is in the front of the free page/modified page list, and the page table entry of the page to be replaced is placed at the end of the free page/modified page list.

1 34 2 56 3 4 .. 10 41 Main memory Modified frames list Page 1 34 2 56 3 4 .. 10 41 Modified frames list Free frames list frame#, page # Head 0, 1 6, 5 7,35 Tail 30,38 frame#, page # Head 3, 4 9, 25 10,41 Tail 11,39 Page to be replaced is page 56 in frame 2, with new page 28 from disk. Page 56 has been modified.

1 34 2 56 3 28 .. 10 41 Main memory Modified frames list Page 1 34 2 56 3 28 .. 10 41 Modified frames list Free frames list frame#, page # Head 9, 25 10,41 11,39 Tail 2,56 frame#, page # Head 0, 1 6, 5 7,35 Tail 30,38 Page to be replaced is page 34 (not modified), with page 41 (already in memory).

1 34 2 56 3 28 .. 10 41 Main memory Modified frames list page # Head 9, 25 11,39 Tail 2,56 Frame # Page 1 34 2 56 3 28 .. 10 41 Free frames list frame#, page # Head 0, 1 6, 5 7,35 30,38 Tail 1,34 If page 28 in frame 3(not been modified) has to be replaced, and page 34 has to be placed in main memory, how with the lists and main memory change?

Resident Set Management Resident set size - How many pages per process in main memory Replacement scope - 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

Resident set size Fixed-allocation – fixed number of frames in main memory for a process. Number decided at creation time Page to be replaced must be from the same process. Variable-allocation – number of pages allocated can change during the duration of the process. If there are many page faults, then increase the number of frames allocated and vice versa. OS has to observe program behavior and predict future behavior.

Replacement scope Global – consider all unlocked frames in main memory as candidates for replacement. Simpler to implement and more commonly used. Local – consider only frames allocated to the process that caused the page fault as candidates for replacement.

Resident set size and replacement scope Fixed allocation, local scope Variable allocation, global scope Easiest to implement and commonly used. Page that is being replaced can be from any process But the process whose resident set size decreases may not be optimum Use page buffering to alleviate the problem.

Variable allocation, local scope When a process is brought into main memory, assign a certain number of frames to the process. When a process page faults frequently, increase its resident set size. Periodically, re-evaluate the allocations to various processes and change resident set sizes.

Cleaning policy When should a modified page be written back to disk. Demand cleaning – write back when a page has to be replaced. Process that suffers a page fault must wait for two disk accesses before it can be unblocked => processor under-utilized. Precleaning – write pages in batches a page may be written to disk many times before it is actually replaced

Load control Number of processes resident in main memory Too few resident processes could result in processor being idle. Too many resident processes could result in frequent page faults and thrashing.

Load control/Multi-programming level strategies Allow only processes whose resident set is sufficiently large. L (interpage fault lifetime) = S (page swap time) criterion Adjust the multi-programming level such that the mean time between page faults equals the mean time required to process a page fault. This is when processor utilization is maximum. If it takes 200ms to service a page fault, then if a page fault occurs every 200ms, then when P1 gets blocked, P2’s page would have just been brought to memory and it will be ready to run.

Load control/Multi-programming level strategies 50% criterion – keep utilization of the paging device at 50%. Adapt the clock page replacement algorithm Monitor the rate at which the pointer scans the circular buffer of frames. If the rate is below a threshold: Few page faults => few requests to advance the pointer. For each request, the number of pages being scanned is small => many pages in the resident set are not being accessed frequently and need not be present. In either case, can decrease the resident set size and increase the multi-programming level.

Process to be suspended to reduce the multi-programming level Lowest-priority process Faulting process – is going to be blocked anyway. Last process activated – least likely to have its resident set. Process with smallest resident set – least future effort to reload. Largest process – releases more frames. Process with largest remaining execution time window – allows processes that are closer to finishing to continue.