Virtual Memory (Chapter 8) Memory Management is an intimate and complex interrelationship between processor hardware and operating system software. Paging.

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 3.3 : OS Policies for Virtual Memory
Virtual Memory II Chapter 8.
Chapter 8 Virtual Memory
OS Fall’02 Virtual Memory Operating Systems Fall 2002.
Segmentation and Paging Considerations
Virtual Memory Chapter 8.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice.
Virtual Memory Characteristics of paging and segmentation
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.
Memory Design Example. Selecting Memory Chip Selecting SRAM Memory Chip.
Operating System Support Focus on Architecture
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.
Chapter 8 Operating System Support (Continued)
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.
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.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
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
Virtual Memory Management
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Chapter 8 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.
Computer Organization and Architecture Operating System Support Chapter 8.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Review of Memory Management, Virtual Memory CS448.
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.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Seventh Edition William Stallings.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
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.
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  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
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.
Memory Management – Page 1CSCI 4717 – Computer Architecture CSCI 4717/5717 Computer Architecture Topic: Memory Management *** Modified – look for Reading:
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.
Operating System 8 VIRTUAL MEMORY. HARDWARE AND CONTROL STRUCTURES.
Virtual Memory Chapter 8.
Virtual memory.
ITEC 202 Operating Systems
Chapter 8 Virtual Memory
Virtual Memory Chapter 8.
Lecture 10: Virtual Memory
Chapter 9 Virtual Memory
Virtual Memory فصل هشتم.
Chapter 9: Virtual Memory
2P13 Week 7.
Operating Systems Concepts
Operating Systems: Internals and Design Principles, 6/E
Presentation transcript:

Virtual Memory (Chapter 8) Memory Management is an intimate and complex interrelationship between processor hardware and operating system software. Paging and segmentation are the keys: All memory references within a process are logical addresses that are dynamically translated into physical address at run-time. A process may be swapped in and out of main memory such that it occupies different regions of main memory at different times during the course of execution. A process may be broken up into a number of pieces (pages or segments). These pieces need not be contiguously located in main memory during execution. The combination of dynamic run-time address translation and the use of a page or segment table permits this. If these characteristics are present, then it is not necessary that all pages or all the segments of a process be in main memory during execution. Only the pieces that holds the next instruction to be fetched and the piece that holds the next data location to be accessed have to be in the main memory.

Virtual Memory for improving System Utility More processes may be maintained in main memory. It is because we are only loading some of the pieces of any particular process, hence, there is room for more processes. This leads to more efficient use of processor. It is more likely that at least one of the more numerous processes will be in a Ready state at any particular time. It is possible for a process to be larger than all the main memory. Otherwise the programmer have to use techniques like overlay. Instead of the main memory, the programmer is dealing with huge memory, the size associated with disk storage. We referred the main memory as “real memory” and the disk storage as “virtual memory”. Table 7.1 summarizes the characteristics of paging and segmentation, with and without the use of virtual memory.

Locality and Virtual Memory The benefit of virtual memory is attractive, but will it work? Scenario: A large program / process with a few large arrays. Efficient means only to have some portion of the code and data in the main memory and trigger a fault when the needed code or data is not in the main memory. However, it demands the system to be clever enough to swap out the right page when bringing in the new ones. If the system throws out a piece just before it is about to be used, then it will have to go and get that piece again almost immediately. Too much of this leads to a condition known as thrashing. When thrashing occurs, the processor spends most of its time swapping pieces rather than executing the programs. Many algorithms are invented just to avoid thrashing and they all based on belief in the principle of locality. The principle of locality states that program and data reference within a process tend to cluster. (Figure 8.1)

Principle of Localoty

Virtual Memory (Combined Segmentation & Paging) Paging only Virtual address: Page_number + Offset Page Table Entry: Present_bit, Modified_bit, Other_control_bits, Frame_number Segmentation only Virtual address: Segment_number + Offset Segment Table Entry: Present_bit, Modified_bit, Other_control_bits, Segment_length, Segment_base_address Combined segmentation and paging Virtual address: Segment_number + Page_number + Offset Segment Table Entry: Control_bits, Segment_length, Segment_base_address Page Table Entry: Present_bit, Modified_bit, Other_control_bits, Frame_number

Virtual Memory Paging System & Segmentation System Paging System Page Table Structure (Figure 8.3) Two-Level Paging System (Figure 8.4, & 8.5) Inverted Page Table (Figure 8.6) Translation Lookaside Buffer -- TLB (Figure 8.7, 8.8, 8.9, & 8.10) Page Size (Figure 8.11 & Table 8.2) Segmentation System Virtual Memory Implications: –Simplifies the handling of growing data structures (dynamic segment size). –Allows programs to be altered and recompiled independently, without requiring the entire set of programs to be relinked or reloaded. –Lends itself to sharing among processes. –Lends itself to protection. Organization: –Combined Segmentation & Paging (Figure 8.12 & 8.13) –Protection & Sharing (Figure 8.14)

Operating System Policies for Virtual Memory Fetch Policy -- Demand vs. Pre-paging Placement Policy -- non-uniform memory access multiprocessor (NUMA) Replacement Policy –Basic Algorithms Optimal Least recently used (LRU) First in first out (FIFO) Clock –Page Buffering Resident Set Management –Resident set size -- Fixed vs. Variable –Replacement scope -- Global vs. Local Cleaning Policy -- Demand vs. Precleaning Load Control -- Degree of multiprogramming

Page Table Structure

Two-Level Paging System

Inverted Page Table

Translation Lookaside Buffer

Page Size

Combined Segmentation & Paging

Protection & Sharing