COMP 3500 Introduction to Operating Systems Memory Management: Part 1 Dr. Xiao Qin Auburn University Slides.

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

11 Memory Management The External View of the Memory Manager Hardware Application Program Application Program File MgrDevice MgrMemory Mgr Process Mgr.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 13: Main Memory (Chapter 8)
Memory Management. Memory Manager Requirements –Minimize executable memory access time –Maximize executable memory size –Executable memory must be cost-effective.
Slide 11-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 11.
Slide 11-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter Memory Management.
Memory Management Chapter 7.
CS 311 – Lecture 21 Outline Memory management in UNIX
Memory Management. Managing Memory … The Simplest Case The O/S User Program 0 0xFFF … * Early PCs and Mainframes * Embedded Systems One user program at.
Modified from Silberschatz, Galvin and Gagne Lecture 16 Chapter 8: Main Memory.
Memory Management.
Memory Management Chapter 7 B.Ramamurthy. Memory Management Subdividing memory to accommodate multiple processes Memory needs to allocated efficiently.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Memory Management Chapter 5.
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.
 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.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 346, Royden, Operating System Concepts Operating Systems Lecture 24 Paging.
Example of a Resource Allocation Graph CS1252-OPERATING SYSTEM UNIT III1.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 32 Paging Read Ch. 9.4.
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.
Memory Management. Process must be loaded into memory before being executed. Memory needs to be allocated to ensure a reasonable supply of ready processes.
Chapter 7 Memory Management
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 8: Memory-Management Strategies Objectives To provide a detailed description.
Memory Management.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
Silberschatz and Galvin  Operating System Concepts Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous.
1 Address Translation Memory Allocation –Linked lists –Bit maps Options for managing memory –Base and Bound –Segmentation –Paging Paged page tables Inverted.
CE Operating Systems Lecture 14 Memory management.
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.
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.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 31 Memory Management.
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Memory and Addressing It all starts.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
Slide 11-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 11.
2010INT Operating Systems, School of Information Technology, Griffith University – Gold Coast Copyright © William Stallings /2 Memory Management.
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.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition, Chapter 8: Memory- Management Strategies.
Main Memory CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
COMP 3500 Introduction to Operating Systems Memory Management: Part 2 Dr. Xiao Qin Auburn University Slides.
Chapter 8: Main Memory.
Chapter 8 Main Memory.
Main Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
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.
Main Memory Background Swapping Contiguous Allocation Paging
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.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
EECE.4810/EECE.5730 Operating Systems
Page Main Memory.
Presentation transcript:

COMP 3500 Introduction to Operating Systems Memory Management: Part 1 Dr. Xiao Qin Auburn University Slides are adopted and modified from Drs. Stallings, Silberschatz, Galvin, Gagne, Nutt

The External View of the Memory Manager Slide courtesy of Dr. Gary Nutt 2

The Basic Memory Hierarchy CPU Registers Primary Memory (Executable Memory) e.g. RAM Secondary Memory e.g. Disk or Tape More Frequently Used Information Less Frequently Used Information Slide courtesy of Dr. Gary Nutt 3 Larger storage Q1: Capacity? Faster access Speed?

LBNL IT Backup Robotic Tape Libraries URL: servback.lbl.gov/backups/equipment/robots.html 4

Memory Management Requirements Q2: Can you list two functionalities? Relocation Protection Sharing Logical organization Physical organization

Address Space vs. Primary Memory 6 Mapped to object other than memory Process Address Space Hardware Primary Memory

7 Load time: Allocate primary memory Adjust addresses in address space Copy address space from secondary to primary memory Loader Process address space Primary memory Compile time: Translate elements Source code Source code C Reloc Object code Reloc Object code Link Edit Link Edit Library code Library code Other objects Other objects Secondary memory Link time: Combine elements Creating an Executable Program

A Sample Code Segment... static int gVar;... int proc_a(int arg){... gVar = 7; put_record(gVar);... }

The Relocatable Object Module Code Segment Relative AddressGenerated Code entryproc_a load=7, R1 0224storeR1, push call ‘ put_record ’ External reference table ‘ put_record ’ External definition table ‘ proc_a ’ (symbol table) (last location in the code segment) Data Segment Relative AddressGenerated variable space [Space for gVar variable] (last location in the data segment)

The Absolute Program After the link editor combines relocatable modules Code Segment Relative AddressGenerated Code 0000(Other modules) entryproc_a load=7, R1 1224storeR1, push call (End of proc_a)... (Other modules) 2334entryput_record (optional symbol table) (last location in the code segment) Data Segment Relative AddressGenerated variable space [Space for gVar variable] (last location in the data segment) Q3: What is the difference Between the absolute program and the relocatable object module?

The Program Loaded at Location 4000 Relative AddressGenerated Code 0000(Other process ’ s programs) 4000(Other modules) entryproc_a [Space for gVar variable] load=7, R1 5224storeR1, push call (End of proc_a)... (Other modules) 6334entryput_record (optional symbol table) (last location in the code segment) 7000(first location in the data segment) [Space for gVar variable] (Other process ’ s programs)

Dynamic Relocation using a Relocation Register Hardware device that maps virtual to physical address The value in the relocation register is added to every address generated by a user process at the time it is sent to memory The user program deals with logical addresses; it never sees the real physical addresses

Static Memory Partitioning  Used in several variations in some now- obsolete operating systems  Does not involve virtual memory 13 Operating System Process 3 Process 0 Process 2 Process 1 Unused In Use Issue: Need a mechanism/policy for loading p i ’s address space into primary memory pipi

14

Memory Management Terms 15 Frame vs. Page vs. Segment

Static Memory Allocation (Cont.) Hole – block of available memory; holes of various size are scattered throughout memory When a process arrives, it is allocated memory from a hole large enough to accommodate it Operating system maintains information about: a) allocated partitions b) free partitions (hole) OS process 5 process 8 process 2 OS process 5 process 2 OS process 5 process 2 OS process 5 process 9 process 2 process 9 process 10

Fixed-Partition Memory Mechanism Operating System Region 3 Region 2 Region 1 Region 0N0N0 N1N1 N2N2 N3N3 pipi p i needs n i units nini

Fixed-Partition Memory Best-Fit Operating System Region 3 Region 2 Region 1 Region 0N0N0 N1N1 N2N2 N3N3 pipi Internal Fragmentation Loader must adjust every address in the absolute module when placed in memory Q4: Pros and Cons?

Fixed-Partition Memory Worst-Fit Operating System Region 3 Region 2 Region 1 Region 0N0N0 N1N1 N2N2 N3N3 pipi Q5: Pros and Cons?

Fixed-Partition Memory First-Fit Operating System Region 3 Region 2 Region 1 Region 0N0N0 N1N1 N2N2 N3N3 pipi Q6: Pros and Cons?

Fixed-Partition Memory Next-Fit Operating System Region 3 Region 2 Region 1 Region 0N0N0 N1N1 N2N2 N3N3 pipi P i+1 Fixed-Partition strategies were used in batch multiprogramming systems (why?) Not good for timesharing systems Q7: Pros and Cons?

Disadvantages A program may be too big to fit in a partition – program needs to be designed with the use of overlays Main memory utilization is inefficient – any program, regardless of size, occupies an entire partition – internal fragmentation wasted space due to the block of data loaded being smaller than the partition 22

Summary Memory Management Requirements Dynamic Relocation using a Relocation Register Static Memory Partitioning Frame vs. Page vs. Segment 23