Operating Systems CMPSCI 377 Lecture 11: Memory Management

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Understanding Operating Systems Fifth Edition
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Allocating Memory.
Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2009, Prentice.
Memory Management Questions answered in this lecture: How do processes share memory? What is static relocation? What is dynamic relocation? What is segmentation?
CS 311 – Lecture 21 Outline Memory management in UNIX
OS Fall’02 Memory Management Operating Systems Fall 2002.
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: Memory Management.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Operating System Support Focus on Architecture
CSCI2413 Lecture 5 Operating Systems Memory Management 1 phones off (please)
Memory Management CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
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.
Chapter 8 Operating System Support
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 ManagementCS-502 Fall Memory Management CS-502 Operating Systems Fall 2006 (Slides include materials from Operating System Concepts, 7 th.
Memory Management Chapter 5.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Computer Organization and Architecture
Silberschatz, Galvin and Gagne  Operating System Concepts Multistep Processing of a User Program User programs go through several steps before.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
 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.
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
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.
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.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
Memory Management. Process must be loaded into memory before being executed. Memory needs to be allocated to ensure a reasonable supply of ready processes.
© 2004, D. J. Foreman 1 Memory Management. © 2004, D. J. Foreman 2 Building a Module -1  Compiler ■ generates references for function addresses may be.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
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.
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.
Memory Management Chapter 7.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
PA0 due 60 hours. Lecture 4 Memory Management OSTEP Virtualization CPU: illusion of private CPU RAM: illusion of private memory Concurrency Persistence.
Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
1 Memory Management Basics. 2 Program P Basic Memory Management Concepts Address spaces Physical address space — The address space supported by the hardware.
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.
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.
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.
Computer Architecture Chapter (8): Operating System Support
Main Memory CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
W4118 Operating Systems Instructor: Junfeng Yang.
Memory Management.
Chapter 8: Main Memory.
Chapter 8: Main Memory.
The Operating System Memory Manager
Multistep Processing of a User Program
Lecture 3: Main Memory.
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Presentation transcript:

Operating Systems CMPSCI 377 Lecture 11: Memory Management Emery Berger University of Massachusetts, Amherst

Course Outline Processes & Threads CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems

Today: Memory Management Terminology Addresses Uniprogramming Multiprogramming Relocation Allocation Policies Fragmentation Compaction Swapping

Memory Management Where in memory is executing process? How do we allow multiple processes to share main memory? What’s an address and how is one interpreted?

Background: Computer Architecture Program executable on disk OS loads program into memory CPU fetches instructions & data from memory while executing program

Memory Management: Terminology Segment: chunk of memory assigned to process Physical address: real address in memory Virtual address: address relative to start of process’s address space

Where Do Addresses Come From? Instruction & data addresses Compile-time: Exact physical location in memory starting from fixed position k Load-time: OS determines process’s starting position, fixes up addresses Execution time: OS can place address anywhere in physical memory

Uniprogramming Only one program at a time ) simplifies memory management OS gets fixed region of memory (e.g., highest) One process at a time Load at address 0 Executes in contiguous memory Compiler generates physical addresses Max address = memory size – OS size OS protected from process by checking addresses

Example: Uniprogramming Simple – but no overlap of I/O, computation

Multiprogramming Requirements Transparency No process aware memory is shared Process has no constraints on physical memory Safety Processes cannot corrupt each other Or the OS Efficiency Performance not degraded due to sharing

Relocation Put OS in high memory Process starts at 0 Max addr = memory size – OS size Load process by allocating contiguous segment for process Smallest addr = base, largest = limit

Static Relocation At load time, OS adjusts addresses in process to reflect position in memory OS cannot move process after relocation

Dynamic Relocation Hardware adds relocation register (base) to virtual address to get physical address Hardware compares address with limit register (addr must be less than base) Test fails ) trap

Relocation, Pros & Cons Advantages Disadvantages OS can easily move process during execution OS can allow process to grow over time Simple, fast hardware Two special registers, add, & compare Disadvantages Slows everything (add on every reference) Can’t share memory between processes “Text” section Process limited to physical memory size Degree of multiprogramming limited All memory of active processes must fit in memory Complicates memory management

Relocation, Properties Transparency Processes largely unaware of sharing Safety Each memory reference checked Efficiency Memory checks fast if done in hardware But: if process grows, may have to be moved (SLOW)

Memory Allocation As processes enter system, grow & terminate, OS must track available and in-use memory Can leave holes OS must decide where to put new processes

Memory Allocation Policies First-fit: Use first hole in which process fits Best-fit: Use smallest hole that’s large enough Worst-fit: Use largest hole What’s best?

Fragmentation Fragmentation = % memory unavailable for allocation, but not in use External fragmentation: Caused by repeated unloading & loading Many small holes No contiguous chunk large enough Internal fragmentation: Space inside process allocations Unavailable to other processes

Compaction Can make space available by compacting process space Eliminate holes

Compaction Example Issues Amount of memory moved Size of created block Other choices?

Alternative: Swapping Swapping = copy process to disk, release all memory When process active, must reload Static relocation: same position(!) Dynamic relocation: ok Compaction simplified if swapping supported But not supported in modern OS’s Interaction with scheduling?

Summary Processes must reside in memory to execute Generally use virtual addresses Translated to physical addresses before accessing memory Segmentation: Allows processes to share memory Expensive to grow over time Swapping: Total being used by all can exceed main memory Increases context switch time