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.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Part IV: Memory Management
Memory Management Chapter 7.
CS 311 – Lecture 21 Outline Memory management in UNIX
Modified from Silberschatz, Galvin and Gagne Lecture 16 Chapter 8: Main Memory.
CS 104 Introduction to Computer Science and Graphics Problems
Memory Management Chapter 5.
Operating System Concepts
Silberschatz, Galvin and Gagne  Operating System Concepts Multistep Processing of a User Program User programs go through several steps before.
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.
Chapter 8: Main Memory.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 8 Operating Systems.
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.
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 8: Memory-Management Strategies Objectives To provide a detailed description.
Chapter 10 Memory Management Part_1. 2 Overview Basic Concepts The major tasks of the memory manger are the allocation and deallocation of main memory.
Chapter 4 Storage Management (Memory Management).
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Silberschatz and Galvin  Operating System Concepts Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous.
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.
Memory Management. Introduction To improve both the utilization of the CPU and the speed of its response to users, the computer must keep several processes.
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.
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.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 31 Memory Management.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 8: Main Memory.
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.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
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 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 8: Memory Management
Chapter 8: Main Memory.
Chapter 8: Memory Management
Main Memory Management
Chapter 8: Main Memory.
Chapter 8: Main Memory.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Storage Management Chapter 9: Memory Management
Module 9: Memory Management
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.
Main Memory Session -15.
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.
CSS 430: Operating Systems - Main Memory
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.
So far… Text RO …. printf() RW link printf Linking, loading
Memory Management-I 1.
Main Memory Background Swapping Contiguous Allocation Paging
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.
Chapter 8: Memory Management strategies
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
OPERATING SYSTEMS MEMORY MANAGEMENT BY DR.V.R.ELANGOVAN.
CSE 542: Operating Systems
Page Main Memory.
Presentation transcript:

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 which memory address the CPU should fetch The instruction is decoded, operated and might be re-saved to memory

Chapter 9- Memory Management Background –an array of bytes containing an address –The CPU gets the instruction from memory based on the program counter value –The memory unit sees the data as a stream of addresses The program is compiled and converted into an executable Program is loaded into memory and associated with a process; the process accesses the data and instructions from memory Process is swapped in and out

Binding Setting the actual address used by the relocator The sequence of addressing by a program –Address Binding –Dynamic Loading –Dynamic Linking –Overlays

Address Binding Binding the instructions and data to memory addresses The source program memory addresses are symbolic 0-x –The compiler binds this to relocatable addresses –The loader will bind relocatable to absolute addresses 0-x 14 bytes from the beginning of the module 74014

The binding of instructions and data to memory can be done at: –compile time - when you know at compile time where program will be in memory an absolute code is generated (.COM in DOS) –load time - don’t know address at compile time, compiler generates a relocatable code; an offset in a program –execution time - combined with special hardware, when a program is moved during exe

Dynamic Loading Routine is not loaded until it is called; good memory utilization –example: main program is loaded into memory; but function is not loaded until it is called The relocatable linking loader will load and update the program address table Advantage: unused programs don’t take up memory (error rtns); done programatically, no extra support from the O/S

Dynamic Linking Opposite of static. With static linking, language libraries are combined into the binary program image (takes up more space) With dynamic, linking is postponed. A stub tells the linker (via an address) to to locate the library routine The O/S must allow multiple processes to access the same memory address

Overlays Segments of routines Keep only the data and instructions in memory that are needed. A overlays B in mem Good for when your total program size > than the memory allocated No extra support from the O/S; programmatically ensure that overlays don’t interfere Used on systems with low resources

Address Space Logical - address generated by the CPU Physical - the address loaded into the memory address register; the set of all physical addresses corresponding to the logical address. The user program never sees this address.

For compile and load time address binding, the logical and physical addresses are the same With executable and address binding, the logical (virtual) and physical differ. This is central to proper memory management. MMU - memory management unit - maps from virtual to physical address. The base register is the relocatable register. This value is added to each user process generated address. Ie (offset)

Swapping Copying a process from memory to disk to free up memory space for other processes

Swapping A process is swapped out of memory and placed in the backing store. (a backing store is a fast disk with a ready queue) –If binding is done at assembly or load, the process must be placed in the same location –If binding done at execution, the process can be placed anywhere.

Context switch time - the time it takes to swap one process out, swap another in the transfer time depends on the amount of memory swapped. It should be low relative to the CPU time. The swap space is separate from the the file system. When you swap, make sure the process is idle. Otherwise an operation (I/O) may try to access the memory of the new process In WIN3.1, the user controls. In NT, MMU features: the scheduler can decide on the process.

The relocation register - the base register is used to give the lowest physical address for a process. Add this to the user process to get the actual address. Main memory supports the O/S and the user programs Partitioned - the O/S and user; O/S usually loaded low (near the interrupt vector)

Contiguous Allocation Single Partition - to protect the O/S from the user; to protect the user programs from each other. Relocation and limit register. MMU maps dynamically and is loaded as part of the context switch. Multiple Partition - divide memory into fixed-sized partitions - each with one process. The degree of multi-programming = the number of partitions. IBM360 used. Fragmentation –External –Internal

Fixed Partitioning Batch processing The O/S keeps track of what memory is available - hole. When a process needs memory, the O/S searches for the holes. FCFS and RR examples.

Fixed Partitioning Algorithms –First fit - the first hole that’s big enough; fastest –Best fit - the smallest hole that’s big enough. Good for storage utilization, but you search the entire list if not sorted by size. –Worst fit - allocate the largest hole; searches entie list unless sorted; produces largest leftover hole - can be allocated to other processes.

Contiguous Allocation Single Partition Multiple Partition Fragmentation –External –Internal

Paging Method Page Table Structure Multilevel Paging Inverted Page Table Shared Pages

Segmentation Method Hardware Implementation of Segment Tables Protection and Sharing Fragmentation

Chapter 10 - Virtual Memory

Virtual Memory Background Definition

Demand Paging Definition Process Hardware support –Page Table –Secondary memory

Demand Paging Performance Page fault Effective access time computation

Page Replacement Process Algorithms –FIFO –Optimal –LRU

LRU Approximation Additional-Reference-Bits Second-Chance Enhanced-Second-Chance

Counting Algorithms Page Buffering

Allocation of Frames Thrashing Other Considerations Demand Segmentation