Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Memory Management Chapter 7.
Fixed/Variable Partitioning
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable supply of ready processes to.
Chapter 7 Memory Management
Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2009, Prentice.
Chapter 7 Memory Management
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Module 3.0: Memory Management
Memory Management Chapter 7 B.Ramamurthy. Memory Management Subdividing memory to accommodate multiple processes Memory needs to allocated efficiently.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Memory Management Chapter 5.
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.
A. Frank - P. Weisberg Operating Systems Real Memory Management.
Silberschatz, Galvin and Gagne  Operating System Concepts Multistep Processing of a User Program User programs go through several steps before.
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Chapter 7 Memory Management
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
1 Memory Management Chapter 7. 2 Roadmap n Memory management u Objectives u Requirements n Simple memory management u Memory partitioning F Fixed partitioning.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
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.
Memory Management Chapter 7.
Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Dr.
Chapter 7 Memory Management
Chapter 4 Storage Management (Memory Management).
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.
Memory Management Chapter 7.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
Subject: Operating System.
Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
1 Memory Management Chapter 8. 2 Memory Management n It is the task carried out by the OS and hardware to accommodate multiple processes in main memory.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Mono an multiprogramming.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 31 Memory Management.
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.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Memory Management Chapter 5 Advanced Operating System.
1 Memory Management n In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes.
2010INT Operating Systems, School of Information Technology, Griffith University – Gold Coast Copyright © William Stallings /2 Memory Management.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Chapter 7 Memory Management
Memory Management Chapter 7.
Chapter 8: Main Memory.
Real Memory Management
Chapter 8 Main Memory.
Main Memory Management
Economics, Administration & Information system
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
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.
Memory Management Chapter 7.
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.
Operating System Chapter 7. Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Presentation transcript:

Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory management issues and requirements   Physical and virtual memory   Fixed and dynamic partitioning   Paging   Segmentation

From Source to Executable Compiler main() sub1() data source program foo.c main sub1 data object modules foo.o printf scanf gets fopen exit data... static library libc.a Linkage Editor main sub1 data printf exit data load module a.out other programs... main sub1 data printf exit data other... kernel Machine memory ? (system calls) Loader (Run Time) Dynamic library case not shown “Load time”

Chapter 93 Linking and Loading  Linking. Bind together the different parts of a program in order to make them into a runnable entity - Linkage editor static (before execution) dynamic (on demand during execution)  Loading. Program is loaded into main memory, ready to execute. May involve address translation. Absolute, relocatable static, dynamic

Chapter 94 Addressing Requirements for a Process

Chapter 95 Binding of Instructions and Data to Memory Addresses Compile time: If memory location known a priori, absolute code can be generated; must recompile code if starting location changes. Load time: If memory location is not known at compile time, compiler must generate relocatable code. Loader knows final location and binds addresses for that location Execution time: If the process can be moved during its execution, binding must be delayed until run time. Need hardware support for address maps (e.g., base and limit registers).

Chapter 96 Aspects of Loading  Finding free memory for load module: could be contiguous or not contiguous  Adjust addresses in program (if required) once it is known where module will be loaded

Chapter 97 Addressing Relative address  Linker unifies all object files into a common single address space  Starts at 0 Absolute address  Actual memory address in real memory when loaded  2 choices Add a constant (size of OS) to all addresses Use reallocation

Chapter 98 Memory Management  Management tasks carried out by the OS and hardware to accommodate multiple programs in main memory If only a few programs can be in main memory, then much of the time all processes will be blocked waiting for I/O and the CPU will be idle So our object is to allocate memory efficiently to pack as many programs into memory as possible

Chapter 99 Memory Management  In most schemes, the kernel occupies some fixed portion of main memory  the rest of memory is shared by all the other programs

Chapter 910 Swapping

Chapter 911 Memory-Management Issues  Relocation  Protection  Sharing  Logical Organization  Physical Organization

Chapter 912 Memory Management Requirements  Relocation Programmer cannot know where the program will be loaded in memory when it is executed A program may be relocated (often) in main memory due to swapping Memory references in code (for both instructions and data) must be translated to actual physical memory addresses

Chapter 913 Memory Management Requirements  Protection Processes should not reference memory locations in another process without permission Cannot do this at compile time, because we do not know where the program will be loaded in memory èaddress references must be checked at run time by hardware

Chapter 914 Memory Management Requirements  Sharing must allow several processes to access a common portion of data or program without compromising protection  cooperating processes may need to share access to the same data structure  Program text can be shared by several processes executing the same program for a different user Saves memory over separate copy for each also applies to dynamic (sharable) libraries

Chapter 915 Memory Management Requirements  Logical Organization Programs are written in modules  code is usually execute-only (reentrant)  data modules can be read-only or read/write  References between modules must be resolved at run time  Segmentation is one useful approach for all this but not the only approach

Chapter 916 Memory Management Requirements  Physical Organization Memory hierarchy: (several types of memory: from slow and large to small and fast.) main memory for program and data currently in use, secondary memory is the long term store for swapping and paging moving information between levels of memory is a major concern of memory and file management (OS)  should be transparent to the application programmer

Chapter 917 Physical and Virtual Memory  Physical Memory: the actual main memory (RAM) of the computer  Virtual Memory: the address space as seen by a program: can be much larger (or much smaller) than the physical memory. We’ll look at virtual memory later…..

Chapter 918 Simple Memory Management  We start with the case where a process image is projected in simple fashion on physical memory normally, this implies that the process image is smaller than physical memory and the program is fully loaded for execution (but see overlays)..  We will look at the following simple memory management techniques : fixed partitioning dynamic partitioning simple paging simple segmentation

Chapter 919 Fixed Partitioning (Single Process)  If only one process allowed (e.g. MS-DOS): only one user partition and one for the OS  Not many decisions to make: program either fits or it doesn’t I/O and Interrupt vectors “OperatingSystem” (BIOS) User space 640k

Chapter 920 Fixed Partitioning  Partition main memory into a set of non overlapping regions called partitions  Partitions can be of equal or unequal sizes ..both pictures show partitioning of 64 M main memory

Chapter 921 Fixed Partitioning  any program smaller than a partition can be loaded into the partition  if all partitions are occupied, the operating system can swap a process out of a partition to make room  a program may be too large to fit in a partition. The programmer would then use overlays: when a module needed is not present the user program must load that module into a part of the program’s partition, overlaying whatever program or data were there before

Chapter 922 Overlays Partition Resident part of the program Swapped part of the program

Chapter 923 Fixed Partitioning  Main memory use is inefficient. Any program, no matter how small, occupies an entire partition. This leaves holes of unused memory inside the partitions: internal fragmentation.  Unequal-size partitions can help put small programs in small partitions but there will still be holes...  Equal-size partitions was used in early IBM’s OS/MFT (Multiprogramming with a Fixed number of Tasks)

Chapter 924 Placement Algorithm with Partitions  Equal-size partitions If there is an available partition, a program can be loaded into that partition  because all partitions are of equal size, it does not matter which partition is used If all partitions are occupied by blocked processes, choose one program to swap out to make room for a new program

Chapter 925 Placement Algorithm with Partitions  Unequal-size partitions: fed from a single queue When it is time to load a process into main memory the smallest available partition that will hold the program is selected increases the level of multiprogramming  Does not eliminate internal fragmentation