Operating Systems Concepts

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

Page Replacement Algorithms
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.
Chapter 8 Virtual Memory
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.
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.
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.
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.
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.
Virtual Memory Chapter 8.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
Chapter 8 Virtual Memory
OS Spring’04 Virtual Memory: Page Replacement Operating Systems Spring 2004.
Maninder Kaur VIRTUAL MEMORY 24-Nov
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Virtual Memory.
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.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
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.
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.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Lecture 11 Page 1 CS 111 Online Virtual Memory A generalization of what demand paging allows A form of memory where the system provides a useful abstraction.
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.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
Chapters 7 & 8 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Project 4 Awards First Place Group 7 Samuel Bartlett Michael Phillips Norman Chen.
Virtual Memory Chapter 8.
Computer Organization
Memory Management (2).
Chapter 9: Virtual Memory – Part I
ITEC 202 Operating Systems
Day 22 Virtual Memory.
Day 20 Virtual Memory.
Chapter 8 Virtual Memory
Virtual Memory Chapter 8.
Lecture 10: Virtual Memory
Main Memory Management
Module 9: Virtual Memory
Chapter 9 Virtual Memory
Chapter 9: Virtual-Memory Management
Memory Management.
Contents Memory types & memory hierarchy Virtual memory (VM)
Chapter 8 Virtual Memory
Module 9: Virtual Memory
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Virtual Memory 1 1.
Presentation transcript:

Operating Systems Concepts Lecture 34, 35 – Memory Swapping, Virtual memory

Multiprogramming with Memory Swapping Not necessary to keep inactive processes in memory Swapping Only put currently running process in main memory Others temporarily moved to secondary storage Maximizes available memory Significant overhead when switching processes

Multiprogramming with Memory Swapping Figure. Multiprogramming in a swapping system in which only a single process at a time is in main memory.

Virtual memory Solves problem of limited memory space Creates the illusion that more memory exists than is available in system Two types of addresses in virtual memory systems Virtual addresses Referenced by processes Physical addresses Describes locations in main memory Memory management unit (MMU) Translates virtual addresses to physical address

Terminology Some key terms related to virtual memory.

Key points in Memory Management 1) Memory references are logical addresses dynamically translated into physical addresses at run time A process may be swapped in and out of main memory occupying different regions at different times during execution 2) A process may be broken up into pieces that do not need to located contiguously in main memory

Breakthrough in Memory Management If both of those two characteristics are present, then it is not necessary that all of the pages or all of the segments of a process be in main memory during execution. If the next instruction, and the next data location are in memory then execution can proceed at least for a time If the piece (segment or page) that holds the next instruction to be fetched and the piece that holds the next data location to be accessed are in main memory, then execution may proceed (at least for a time).

Execution of a Process Operating system brings into main memory a few pieces of the program Resident set - portion of process that is in main memory An interrupt is generated indicating a memory access fault usually a page fault, when an address is needed that is not in main memory Operating system places the process in a blocking state

Execution of a Process Piece of process that contains the logical address is brought into main memory Operating system issues a disk I/O Read request Another process is dispatched to run while the disk I/O takes place An interrupt is issued when disk I/O complete which causes the operating system to place the affected process in the Ready state

Implications of this new strategy More processes may be maintained in main memory Only load in some of the pieces of each process With so many processes in main memory, it is very likely a process will be in the Ready state at any particular time A process may be larger than all of main memory Without the scheme a programmer must be acutely aware of how much memory is available. If the program being written is too large, the programmer must devise ways to structure the program into pieces that can be loaded separately in some sort of overlay strategy. With virtual memory based on paging or segmentation, that job is left to the operating system and the hardware. As far as the programmer is concerned, he or she is dealing with a huge memory, the size associated with disk storage. The operating system automatically loads pieces of a process into main memory as required.

Real and Virtual Memory Real memory Main memory, the actual RAM Virtual memory Memory on disk Allows for effective multiprogramming and relieves the user of tight constraints of main memory

Thrashing A state in which the system spends most of its time swapping pieces rather than executing instructions. To avoid this, the operating system tries to guess which pieces are least likely to be used in the near future. The guess is based on recent history

Replacement Policy When all of the frames in main memory are occupied and it is necessary to bring in a new page, the replacement policy determines which page currently in memory is to be replaced. But.. Which page is replaced? Page removed should be the page least likely to be referenced in the near future How is that determined? Most policies predict the future behavior on the basis of past behavior

Basic Replacement Algorithms There are certain basic algorithms that are used for the selection of a page to replace, they include Optimal Least recently used (LRU) First-in-first-out (FIFO) Clock

Optimal policy Selects for replacement that page for which the time to the next reference is the longest This policy results in the fewest number of page faults. But Impossible to have perfect knowledge of future events However, it does serve as a standard against which to judge real world algorithms.

Least Recently Used (LRU) Replaces the page that has not been referenced for the longest time Usually, this should be the page least likely to be referenced in the near future as well Difficult to implement One approach is to tag each page with the time of last reference. This requires a great deal of overhead.

First-in, first-out (FIFO) Page that has been in memory the longest is replaced Simplest replacement policy to implement But, these pages may be needed again very soon if it hasn’t truly fallen out of use The logic behind this choice is that one is replacing the page that has been in memory the longest: A page fetched into memory a long time ago may have now fallen out of use. This reasoning will often be wrong, because there will often be regions of program or data that are heavily used throughout the life of a program. Those pages will be repeatedly paged in and out by the FIFO algorithm. The first-in-first-out (FIFO) policy treats the page frames allocated to a process as a circular buffer, and pages are removed in round-robin style. All that is required is a pointer that circles through the page frames of the process. This is one of the simplest page replacement policies to implement.

Clock Policy Uses an additional bit called a “use bit” When a page is first loaded in memory or referenced, the use bit is set to 1 When it is time to replace a page, the OS scans the set flipping all 1’s to 0 The first frame encountered with the use bit already set to 0 is replaced.

Thank You!