Understanding Operating Systems Seventh Edition

Slides:



Advertisements
Similar presentations
Understanding Operating Systems Fifth Edition
Advertisements

Memory Management Design & Implementation Segmentation Chapter 4.
Chapter 3 Memory Management: Virtual Memory
Chapter 7 Memory Management
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
Understanding Operating Systems1 Operating Systems Virtual Memory Thrashing Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions.
Memory Management 2010.
Memory Organization.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Understanding Operating Systems Fifth Edition
Computer Organization and Architecture
Virtual Memory Deung young, Moon ELEC 5200/6200 Computer Architecture and Design Lectured by Dr. V. Agrawal Lectured by Dr. V.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
Chapter 7 Memory Management
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Understanding Operating Systems Fifth Edition
Chapter 3 Memory Management: Virtual Memory
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Memory Management Chapter 7.
Understanding Operating Systems Seventh Edition
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Chapter 4 Memory Management Virtual Memory.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
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.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
Memory Management Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only storage.
Understanding Operating Systems Fifth Edition Chapter 3 Memory Management: Virtual Memory.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Virtual Memory By CS147 Maheshpriya Venkata. Agenda Review Cache Memory Virtual Memory Paging Segmentation Configuration Of Virtual Memory Cache Memory.
Understanding Operating Systems Seventh Edition
Chapter 7 Memory Management
Computer Organization
ITEC 202 Operating Systems
Chapter 2 Memory and process management
Chapter 9 – Real Memory Organization and Management
William Stallings Computer Organization and Architecture
CSI 400/500 Operating Systems Spring 2009
Virtual Memory Chapter 8.
Main Memory Management
Chapter 8: Main Memory.
Operating Systems course 2006/2007 Virtual memory
O.S Lecture 13 Virtual Memory.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Operating Systems.
Computer Architecture
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Memory Management: Early System.
Main Memory Background Swapping Contiguous Allocation Paging
Chapter 8: Memory management
Chapter 9: Virtual Memory
Operating System Chapter 7. Memory Management
Memory management Explain how memory is managed in a typical modern computer system (virtual memory, paging and segmentation should be described.
Contents Memory types & memory hierarchy Virtual memory (VM)
Understanding Operating Systems Seventh Edition
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Page Main Memory.
Presentation transcript:

Understanding Operating Systems Seventh Edition Chapter 3 Memory Management: Virtual Memory Systems

Learning Objectives After completing this chapter, you should be able to describe: The basic functionality of the memory allocation methods covered in this chapter: paged, demand paging, segmented, and segmented/demand paged memory allocation The influence that these page allocation methods have had on virtual memory The concept of the working set and how it is used in memory allocation schemes Cache memory and its role in improving system response time Understanding Operating Systems, 7e

Introduction Virtual memory Evolution of virtual memory Appearance of vast amounts of physical memory Evolution of virtual memory Paged, demand paging, segmented, segmented/demand paging Foundation of current virtual memory methods Areas of improvement from the need for: Continuous program storage Placement of entire program in memory during execution Enhanced Memory Manager performance: cache memory Understanding Operating Systems, 7e

Paged Memory Allocation Incoming job: divided into pages of equal size Best condition Pages, sectors, and page frames: same size Exact sizes: determined by disk’s sector size Memory manager tasks: prior to program execution Determine number of pages in program Locate enough empty page frames in main memory Load all program pages into page frames Understanding Operating Systems, 7e

Paged Memory Allocation (cont’d.) Program: stored in noncontiguous page frames Advantages: more efficient memory use; compaction scheme eliminated (no external fragmentation) New problem: keeping track of job’s pages (increased operating system overhead) Understanding Operating Systems, 7e

Paged Memory Allocation (cont'd.) (figure 3.1) In this example, each page frame can hold 100 bytes. This job, at 350 bytes long, is divided among four page frames with internal fragmentation in the last page frame. © Cengage Learning 2014 Understanding Operating Systems, 7e

Paged Memory Allocation (cont’d.) Internal fragmentation: job’s last page frame only Entire program: required in memory during its execution Three tables for tracking pages: Job Table (JT), Page Map Table (PMT), and Memory Map Table (MMT) Stored in main memory: operating system area Understanding Operating Systems, 7e

Paged Memory Allocation (cont’d.) Job Table: information for each active job Job size Memory location: job’s PMT Page Map Table: information for each page Page number: beginning with Page 0 Memory address Memory Map Table: entry for each page frame Location Free/busy status Understanding Operating Systems, 7e

Paged Memory Allocation (cont'd.) (table 3.1) This section of the Job Table initially has one entry for each job (a). When the second job ends (b), its entry in the table is released and then replaced by the entry for the next job (c). © Cengage Learning 2014 Understanding Operating Systems, 7e

Demand Paging Memory Allocation Loads only a part of the program into memory Removes restriction of entire program in memory Requires high-speed page access Exploits programming techniques Modules: written sequentially All pages: not needed simultaneously Examples Error-handling modules instructions Mutually exclusive modules Certain program options: mutually exclusive or not always accessible Understanding Operating Systems, 7e

Demand Paging (cont'd.) Made virtual memory feasible Appearance of vast amounts of physical memory Less main memory required than paged memory allocation scheme Requires high-speed direct access storage device (DASDs): e.g., hard drives or flash memory Swapping: how and when pages passed between memory and secondary storage Depends on predefined policies Understanding Operating Systems, 7e

Demand Paging Memory Allocation (cont'd.) Job Table, Page Map Table, and Memory Map Table Page Map Table First field: page requested already in memory? Second field: page contents modified? Third field: page referenced recently? Fourth field: frame number Understanding Operating Systems, 7e

Demand Paging Memory Allocation (cont'd.) Swapping process Resident memory page: exchanged with secondary storage page Resident page: copied to disk (if modified) New page: written into available page frame Requires close interaction between hardware components, software algorithms & policy schemes Tables updated when page swap occurs PMT for both jobs (page swapped out; page swapped in) and the MMT Understanding Operating Systems, 7e

Demand Paging Memory Allocation (cont'd.) Thrashing Excessive page swapping: inefficient operation Main memory pages: removed frequently; called back soon thereafter Occurs across jobs Large number of jobs: limited free pages Occurs within a job Loops crossing page boundaries Understanding Operating Systems, 7e

The Working Set Working set - collection of pages residing in memory that can be accessed without incurring a page fault (desired job page not resident in memory and requiring page swapping). Working set typically changes over the execution of the job. Most programs are well structured which leads to locality of reference – during any phase of execution the program references a small portion of its pages and they are already resident in memory. A poorly structured program might require that all pages be resident in memory to begin or may consistently reference pages that are not resident in memory (page faults). Understanding Operating Systems, 7e

The Working Set Understanding Operating Systems, 7e

Segmented Memory Allocation Each job divided into several segments: different sizes One segment for each module: related functions Reduces page faults Loops: not split over two or more pages Main memory: allocated dynamically Program’s structural modules: determine segments Each segment numbered when program compiled/assembled Segment Map Table (SMT) generated Understanding Operating Systems, 7e

Understanding Operating Systems, 7e (figure 3.14) Segmented memory allocation. Job 1 includes a main program and two subroutines. It is a single job that is structurally divided into three segments of different sizes. © Cengage Learning 2014 Understanding Operating Systems, 7e

Understanding Operating Systems, 7e (figure 3.15) The Segment Map Table tracks each segment for this job. Notice that Subroutine B has not yet been loaded into memory. © Cengage Learning 2014 Understanding Operating Systems, 7e

Understanding Operating Systems, 7e (figure 3.16) During execution, the main program calls Subroutine A, which triggers the SMT to look up its location in memory. © Cengage Learning 2014 Understanding Operating Systems, 7e

Segmented Memory Allocation (cont'd.) Memory Manager: tracks segments in memory Job Table: one for whole system Every job in process Segment Map Table: one for each job Details about each segment Memory Map Table: one for whole system Main memory allocation Instructions within each segment: ordered sequentially Segments: not necessarily stored contiguously Understanding Operating Systems, 7e

Segmented Memory Allocation (cont'd.) Disadvantage Dynamic allocation leads to external fragmentation requiring compaction Major difference between paging and segmentation Pages: physical units; invisible to the program Segments: logical units; visible to the program; variable sizes Understanding Operating Systems, 7e

Segmented/Demand Paged Memory Allocation Subdivides segments: equal-sized pages Smaller than most segments More easily manipulated than whole segments Segmentation’s logical benefits Paging’s physical benefits Segmentation problems removed Compaction, external fragmentation, secondary storage handling Understanding Operating Systems, 7e

Segmented/Demand Paged Memory Allocation (cont'd.) Scheme requires four tables Job Table: one for the whole system Every job in process Segment Map Table: one for each job Details about each segment Page Map Table: one for each segment Details about every page Memory Map Table: one for the whole system Monitors main memory allocation: page frames Disadvantages Overhead: managing the tables Time required: referencing tables Understanding Operating Systems, 7e

Understanding Operating Systems, 7e (figure 3.17) How the Job Table, Segment Map Table, Page Map Table, and main memory interact in a segment/paging scheme. © Cengage Learning 2014 Understanding Operating Systems, 7e

Virtual Memory Made possible by swapping pages in/out of memory Program execution: only a portion of the program in memory at any given moment Requires cooperation between: Memory Manager: tracks each page or segment Processor hardware: issues the interrupt and resolves the virtual address Understanding Operating Systems, 7e

Understanding Operating Systems, 7e Internal fragmentation – occurs with fixed sized partition memory allocation, portion of the allocated partition is not used. Difficult to resolve. External fragmentation – occurs with dynamically allocated memory, small unused portion of memory (external to allocation portion). Can be resolved through compaction. (table 3.6) Comparison of the advantages and disadvantages of virtual memory with paging and segmentation. © Cengage Learning 2014 Understanding Operating Systems, 7e

Virtual Memory (cont'd.) Advantages Job size: not restricted to size of main memory More efficient memory use Unlimited amount of multiprogramming possible Code and data sharing allowed Dynamic linking of program segments facilitated Disadvantages Higher processor hardware costs More overhead: handling paging interrupts Increased software complexity: to prevent thrashing Understanding Operating Systems, 7e

Cache Memory Small, high-speed intermediate memory unit to supplement main memory Computer system’s performance increased Faster processor access compared to main memory Stores frequently used data and instructions Cache levels L2: connected to CPU; contains copy of bus data L1: pair built into CPU; stores instructions and data Data/instructions: move between main memory and cache Methods similar to paging algorithms Understanding Operating Systems, 7e

Understanding Operating Systems, 7e (figure 3.19) Comparison of (a) the traditional path used by early computers between main memory and the CPU and (b) the path used by modern computers to connect the main memory and the CPU via cache memory. © Cengage Learning 2014 Understanding Operating Systems, 7e

Cache Memory (cont'd.) Four cache memory design factors Cache size, block size, block replacement algorithm, and rewrite policy Optimal cache and replacement algorithm 80-90% of all requests in cache possible Cache hit ratio 𝐻𝑖𝑡𝑅𝑎𝑡𝑖𝑜= 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑟𝑒𝑞𝑢𝑒𝑠𝑡𝑠 𝑓𝑜𝑢𝑛𝑑 𝑖𝑛 𝑡ℎ𝑒 𝑐𝑎𝑐ℎ𝑒 𝑡𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑟𝑒𝑞𝑢𝑒𝑠𝑡𝑠 ∗100 Understanding Operating Systems, 7e

Summary Operating system: Memory Manager Allocating memory storage: main memory, cache memory, and registers Deallocating memory: execution completed Understanding Operating Systems, 7e

Understanding Operating Systems, 7e (table 3.7) The big picture. Comparison of the memory allocation schemes discussed in Chapters 2 and 3. © Cengage Learning 2014 Understanding Operating Systems, 7e

Understanding Operating Systems, 7e (table 3.7) (cont’d.) The big picture. Comparison of the memory allocation schemes discussed in Chapters 2 and 3. © Cengage Learning 2014 Understanding Operating Systems, 7e