Memory Management © 2004, D. J. Foreman.

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Chapter 2: Memory Management, Early Systems
Memory Management Chapter 7.
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Multiprocessing Memory Management
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
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 2010.
Memory Management (continued) CS-3013 C-term Memory Management CS-3013 Operating Systems C-term 2008 (Slides include materials from Operating System.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Memory Management Chapter 5.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
Memory management. Instruction execution cycle Fetch instruction from main memory Decode instruction Fetch operands (if needed0 Execute instruction Store.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Review of Memory Management, Virtual Memory CS448.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
© 2004, D. J. Foreman 1 Memory Management. © 2004, D. J. Foreman 2 Building a Module -1  Compiler ■ generates references for function addresses may be.
1 Memory Management Chapter Basic memory management 4.2 Swapping (εναλλαγή) 4.3 Virtual memory (εικονική/ιδεατή μνήμη) 4.4 Page replacement algorithms.
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.
CE Operating Systems Lecture 14 Memory management.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Chapter 4 Memory Management Virtual Memory.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Memory Management Operating Systems CS550. Memory Manager Memory manager - manages allocation and de-allocation of main memory Plays significant impact.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Memory Management Chapter 5 Advanced Operating System.
Ch. 4 Memory Mangement Parkinson’s law: “Programs expand to fill the memory available to hold them.”
2010INT Operating Systems, School of Information Technology, Griffith University – Gold Coast Copyright © William Stallings /2 Memory Management.
Main Memory CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Memory Management Chapter 7.
Chapter 7 Memory Management
Memory Management Chapter 7.
Chapter 2 Memory and process management
Memory management.
Chapter 8: Main Memory.
Chapter 9 – Real Memory Organization and Management
Chapter 8 Main Memory.
Virtual Memory © 2004, D. J. Foreman.
CSI 400/500 Operating Systems Spring 2009
Main Memory Management
Chapter 8: Main Memory.
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.
The Operating System Memory Manager
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.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Main Memory Background Swapping Contiguous Allocation Paging
CS399 New Beginnings Jonathan Walpole.
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 3: Main Memory.
CSE 451: Operating Systems Autumn 2005 Memory Management
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.
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Virtual Memory © 2004, D. J. Foreman.
COMP755 Advanced Operating Systems
CSE 542: Operating Systems
Presentation transcript:

Memory Management © 2004, D. J. Foreman

Building a Module -1 Compiler Linker or Link Editor generates references for function addresses may be inside current file may be external - in a separate compile addresses are 'marked' in compiler output - the "object" file Linker or Link Editor Resolves addresses (references) Makes them relative to start of module Saves relocatable module © 2004, D. J. Foreman

Building a Module -2 Loader Builds a table of addresses (ref table) References Definitions replaces every relative address with sum of actual load address + relative address gives control to the module original relocatable file is still on disk This is called "static binding" of the logical address to the physical address © 2004, D. J. Foreman

Building a Module -3 Dynamic memory - malloc, etc Linker examines all calls to malloc Adds up requests (as much as possible) Adds space for stack data Loader assigns space for both Heap space allocated from one end of block Stack space allocated from other end Grow toward middle Ask O/S for more, when space is gone © 2004, D. J. Foreman

Strategies Fixed-size partition Variable-size partition Divide all RAM into N blocks Program size must be < block size Internal fragments exist - cannot be used Variable-size partition Blocks defined as needed Must keep track of blocks External fragmentation occurs and gets worse Smaller holes left, as processes fill old holes Favors smaller and smaller processes Eventually must move processes © 2004, D. J. Foreman

Managing fragments Move programs - compaction Allocation strategies Best fit - search for block with closest size Worst fit - find biggest block - leaves largest hole when program terminates First fit - use first hole in list, from front Next fit - circular list, just use next entry in list Part of block points to next Helps manage 'garbage collection' - the process of building big blocks from little ones © 2004, D. J. Foreman

Current Strategies All use variable-sized partitions Most use fixed sized blocks within the partition - will be called pages Simplifies list mgmt Other considerations: Program segments don't (usually) change size If pgm seg changes size, pgm must be moved Loader must re-bind - increases overhead © 2004, D. J. Foreman

Dynamic Binding All addresses are relative to "0" Adjust all addresses as in static binding Repeat when moving program Can be done with h/w relocation register Simple relocation done easily h/w adjusts every memory reference Relocation value added as needed © 2004, D. J. Foreman

Improvements Multiple relocation registers Code segment register - during fetch cycle Stack segment register - for stack instructions Data segment register - during execute cycle Automatic relocation-register management Compiler generates code to update register when references cross segment boundary No auto-help for Assembler programs Programs with data segments > register capability Programs that change segment registers © 2004, D. J. Foreman

Making it work Trusted s/w for register manipulation Privileged instructions Compiler generates a segment trap NOT a violation trap O/S changes the relocation registers O/S changes the Program Counter Also privileged Program proceeds © 2004, D. J. Foreman

Isolation Need to ensure access protection "Limit register" added Contains length of segment Compute: segment register + relative address If relative address <= limit then proceed Else segment fault (protection error) © 2004, D. J. Foreman

Swapping Swapping removes the entire address space Cost analysis: If a process has S memory space units And a disk block holds D memory units K=Ceil (S/D) disk writes required to save And K reads to restore it later = 2*K overhead If Pi is blocked for T time, cost = T*S T must be > X (assume 1 I/O = 1 Time unit) © 2004, D. J. Foreman

Another strategy Swapping removes an entire process What if we only remove specific blocks? Must recognize spatial locality Sometimes called locality of reference We can remove/restore selected pages © 2004, D. J. Foreman

Virtual Memory Mgmt Responsibilities: Problems: Determine locality Keep referenced pages in memory Problems: Partitioning Scatter-loading Re-binding © 2004, D. J. Foreman

Shared Memory Multiprocessors need to share Increases bus load, reduces speed Speedup via cache, but new problems: Stale data (coherency) Expense Interconnection networks: More speed More expense Must detect changes everywhere Must force cache update synch © 2004, D. J. Foreman