© 2004, D. J. Foreman 1 Memory Management. © 2004, D. J. Foreman 2 Building a Module -1  Compiler ■ generates references for function addresses may be.

Slides:



Advertisements
Similar presentations
Chapter 4 Memory Management Basic memory management Swapping
Advertisements

Part IV: Memory Management
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.
Operating Systems CMPSCI 377 Lecture 11: Memory Management
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Multiprocessing Memory Management
CS 104 Introduction to Computer Science and Graphics Problems
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.
CS 333 Introduction to Operating Systems Class 9 - Memory Management
Lecture 9: SHELL PROGRAMMING (continued) Creating shell scripts!
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
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.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
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.
SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally MEMORYMANAGEMNT.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
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.
Memory Management 1 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
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.
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.
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.
NETW3005 Memory Management. Reading For this lecture, you should have read Chapter 8 (Sections 1-6). NETW3005 (Operating Systems) Lecture 07 – Memory.
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.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
CHAPTER 3-1, 3-2 MEMORY MANAGEMENT. MEMORY HIERARCHY Small amount of expensive, fast, volatile cache Larger amount of still fast, but slower, volatile.
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.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Memory Management Chapter 7.
Memory management.
Memory Management © 2004, D. J. Foreman.
Chapter 9 – Real Memory Organization and Management
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.
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 Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
CS399 New Beginnings Jonathan Walpole.
Lecture 3: Main Memory.
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
Presentation transcript:

© 2004, D. J. Foreman 1 Memory Management

© 2004, D. J. Foreman 2 Building a Module -1  Compiler ■ 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 3 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 4 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 5 Strategies  Fixed-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 6 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 7 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 8 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 9 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 10 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 11 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 12 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 P i is blocked for T time, cost = T*S ■ T must be > X (assume 1 I/O = 1 Time unit)

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

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

© 2004, D. J. Foreman 15 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