Lecture 30 Syed Mansoor Sarwar

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Basic Memory Management 1. Readings r Silbershatz et al: chapters
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: Memory Management.
Modified from Silberschatz, Galvin and Gagne Lecture 16 Chapter 8: Main Memory.
03/09/2007CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Memory Management CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Modified from Silberschatz, Galvin and Gagne Lecture 15 Chapter 8: Main Memory.
MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.
Operating System Concepts
Main Memory. Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only.
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
CSCI 315 Operating Systems Design
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 8: Main Memory.
Swapping and Contiguous Memory Allocation. Multistep Processing of a User Program User programs go through several steps before being run. Program components.
Lecture 13 L.Mohammad R.Alkafagee1.  The concept of a logical address space that is bound to a separate physical address space is central to proper memory.
A genda for Today What is memory management Source code to execution Address binding Logical and physical address spaces Dynamic loading, dynamic linking,
Operating Systems Memory Management.
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 8: Memory-Management Strategies Objectives To provide a detailed description.
Chapter 4 Storage Management (Memory Management).
Operating Systems Memory management. Memory Management List of Topics 1. Memory Management 2. Memory In Systems Design 3. Binding Times 4. Introduction.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
1 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Chapter 10 Memory Management Introduction Process must be loaded into memory before being executed. Input queue – collection of processes on the.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
Operating Systems Lecture 31.
NETW3005 Memory Management. Reading For this lecture, you should have read Chapter 8 (Sections 1-6). NETW3005 (Operating Systems) Lecture 07 – Memory.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 31 Memory Management.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Operating Systems Lecture 31 Syed Mansoor Sarwar.
Memory management The main purpose of a computer system is to execute programs. These programs, together with the data they access, must be in main memory.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Main Memory CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Module 9: Memory Management
Chapter 9: Memory Management
SLC/VER1.0/OS CONCEPTS/OCT'99
Chapter 2 Memory and process management
Chapter 8: Main Memory.
CSC 322 Operating Systems Concepts Lecture - 12: by
Chapter 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 8: Main Memory.
Chapter 8 Main Memory.
Instructor: Junfeng Yang
Main Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Module 9: Memory Management
The Operating System Memory Manager
MEMORY MANAGEMENT & their issues
Chapter 8: Main Memory.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Multistep Processing of a User Program
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Lecture 32 Syed Mansoor Sarwar
Memory Management Tasks
Chapter 8: Memory management
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Lecture 36 Syed Mansoor Sarwar
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Grades so far (max was 31).
Lecture 35 Syed Mansoor Sarwar
OPERATING SYSTEMS MEMORY MANAGEMENT BY DR.V.R.ELANGOVAN.
Presentation transcript:

Lecture 30 Syed Mansoor Sarwar Operating Systems Lecture 30 Syed Mansoor Sarwar

© Copyright Virtual University of Pakistan Agenda for Today Review of previous lecture What is memory management Source code to execution Address binding Logical and physical address spaces Dynamic loading, dynamic linking, and overlays Recap of lecture 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Review of Lecture 29 Deadlock detection Deadlock recovery Process termination Resource preemption 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Memory Hierarchy Very small, extremely fast, extremely expensive, and volatile CPU registers Small, very fast, expensive, and volatile cache Hundreds of megabytes of medium-speed, medium-price, volatile main memory Hundreds of gigabytes of slow, cheap, and non-volatile secondary storage 10 December 2018 © Copyright Virtual University of Pakistan

Purpose of Memory Management To ensure fair, secure, orderly, and efficient use of memory 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Memory Management Keeping track of used and free memory space When, where, and how much memory to allocate and deallocate Swapping processes in and out of main memory 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Source to Execution Compile/Assemble ↓ Link Load Execute 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Address Binding Binding instructions and data to memory addresses Compile time Load time Execution time 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Address Binding Compile time: If you know at compile time where the process will reside in memory, the absolute code can be generated. Process must reside in the same memory region for it to execute correctly. 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Address Binding Load time: If the location of a process in memory is not known at compile time, then the compiler must generate re-locatable code. In this case the final binding is delayed until load time. Process can be loaded in different memory regions. 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Address Binding Execution time: If the process can be moved during its execution from one memory region to another, then binding must be delayed until run time. Special hardware must be available for this to work. 10 December 2018 © Copyright Virtual University of Pakistan

Logical and Physical Addresses Logical address: An address generated by the process/CPU; refers to an instruction or data in the process Physical address: An address for a main memory location where instruction or data resides 10 December 2018 © Copyright Virtual University of Pakistan

Logical and Physical Address Spaces The set of all logical addresses generated by a process comprises its logical address space. The set of physical addresses corresponding to these logical addresses comprises the physical address space for the process. 10 December 2018 © Copyright Virtual University of Pakistan

Logical and Physical Address Spaces The run-time mapping from logical to physical addresses is done by a piece of the CPU hardware, called the memory management unit (MMU). 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Example The base register is called the relocation register. The value in the relocation register is added to every address generated by a user process at the time it is sent to memory. 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Example 14000 Process 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Example In i8086, the logical address of the next instruction is specified by the value of instruction pointer (IP). The physical address for the instruction is computed by shifting the code segment register (CS) left by four bits and adding IP to it. 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Example CS * 24 Physical address Logical address + CPU MMU 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Example Logical address (16-bit) IP = 0B10h CS = D000h Physical address (20-bit) CS * 24 + IP = D0B10h Sizes of logical and physical address spaces? 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Dynamic Loading With dynamic loading, a routine is not loaded into the main memory until it is called. All routines are kept on the disk in a re-locatable format. The main program is loaded into memory and is executed 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Dynamic Loading Advantages Potentially less time needed to load a program Potentially less memory space needed Disadvantage Run-time activity 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Dynamic Linking In static linking, system language libraries are linked at compile time and, like any other object module, are combined by the loader into the binary image 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Dynamic Linking In dynamic linking, linking is postponed until run-time. A library call is replaced by a piece of code, called stub, which is used to locate memory-resident library routine 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Dynamic Linking During execution of a process, stub is replaced by the address of the relevant library code and the code is executed If library code is not in memory, it is loaded at this time 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Dynamic Linking Advantages Potentially less time needed to load a program Potentially less memory space needed Less disk space needed to store binaries 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Dynamic Linking Disadvantages Time-consuming run-time activity, resulting in slower program execution gcc compiler Dynamic linking by default -static option allows static linking 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Recap of Lecture What is memory management From source code to execution Address binding Logical and physical address spaces Dynamic loading Dynamic linking 10 December 2018 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Operating Systems Lecture 30 Syed Mansoor Sarwar 10 December 2018 © Copyright Virtual University of Pakistan