The Operating System Memory Manager

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Part IV: Memory Management
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 13: Main Memory (Chapter 8)
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
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: Memory Management.
Operating Systems CMPSCI 377 Lecture 11: Memory Management
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
MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.
Silberschatz, Galvin and Gagne  Operating System Concepts Multistep Processing of a User Program User programs go through several steps before.
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.
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.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
CS333 Intro to Operating Systems Jonathan Walpole.
Chapter 8 Memory Management Dr. Yingwu Zhu. Outline Background Basic Concepts Memory Allocation.
Chapter 4 Memory Management.
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.
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 Basics. 2 Program P Basic Memory Management Concepts Address spaces Physical address space — The address space supported by the hardware.
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
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Memory Management Overview.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Mono an multiprogramming.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
CSC 360, Instructor Kui Wu Memory Management I: Main 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.
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 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.
Main Memory CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Chapter 8: Main Memory.
CSC 322 Operating Systems Concepts Lecture - 12: by
Memory Management © 2004, D. J. Foreman.
Chapter 9 – Real Memory Organization and Management
Chapter 8 Main Memory.
Main Memory Management
Module IV Memory Organization.
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.
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Segmentation Lecture November 2018.
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.
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.
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
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.
Memory Management Overview
Lecture 3: Main Memory.
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.
EECE.4810/EECE.5730 Operating Systems
Page Main Memory.
Presentation transcript:

The Operating System Memory Manager Memory Management The Operating System Memory Manager This lecture: Memory hierarchy Physical vs logical (virtual) address space Address binding Relocation and Protection Reading: Bacon 6.1-6.5

The Memory Hierarchy OS OS Storage Access Capacity Managed Type Time by Registers 100 to 1K compiler 1 ns Cache Memory CPU 8 to 128M 2-20 ns hardware Main 100M 100 ns OS Memory to 1G 10M to 1T Disk 10 ms OS Storage 19 November 2018 CS2051 Lecture 9

Background Program must be brought into memory and placed within a process so that it can be run. Simplest scheme: mono-programming: Memory is shared only between operating system (resident part) and the program. If the program was too big? …overlay techniques Multiprogramming: simple but not efficient: fixed partitions more dynamic approaches are needed, which introduce interesting problems! 19 November 2018 CS2051 Lecture 9

Multiple processes share memory Transparency No process needs to be aware of this Processes should not care about physical memory allocation Safety processes should not be able to write to each other’s space Efficiency Two fundamental problems: Relocation and protection Also: How to allocate/manage memory? What if memory does not suffice? (swapping) 19 November 2018 CS2051 Lecture 9

The Address Space Machine instructions: Address width is: load (r1) jump (r3) Address width is: 32 bits in Pentium 64 bits in Alpha, Itanium, SPARC-V9 Addresses need binding to locations before use Physical address space vs virtual address space (recall slide 3 from lecture 2) 19 November 2018 CS2051 Lecture 9

Address Binding Requirement Compiler allocates addresses within module Linker allocates addresses within program application libraries heap gap stack 128K application libraries heap gap stack 192K Program b Program a 19 November 2018 CS2051 Lecture 9

Address Binding in Action Option (a): Static relocation: fix up addresses when program is loaded But … once a process is assigned a place in memory the OS cannot move it (unless ???)! Option (b): Dynamic relocation: use Dynamic Address Translation Translate program addresses into main memory addresses during execution using H/W Use different translations for different programs 19 November 2018 CS2051 Lecture 9

Dynamic Translation: Datum scheme P1 OS P2 P3 D1 D2 D3 P1 NB: Fragmentation P2 P3 19 November 2018 CS2051 Lecture 9

Relocation & Protection H/W Base Register + Virtual (or Logical) Address from CPU Physical Address to Memory >? Limit Register ERROR MMU 19 November 2018 CS2051 Lecture 9

(Contiguous) Memory Allocation As processes are created, grow(?), terminate, the OS must keep track of the memory available: P1 OS P2 P3 free T0: 3 processes T1: P1, P2 finished P4 arrived P4 OS free P3 P4 OS free P3 P5 T2: P5 arrived How to allocate memory? How to deal with fragmentation? How to reclaim memory? How to know what memory is available? 19 November 2018 CS2051 Lecture 9

(Contiguous) Memory Allocation -2 Memory allocation policies: First-fit: first hole that is big enough Best-fit: the smallest hole that is big enough Worst-fit: the largest hole Fragmentation: External (as before - reduce by compaction) Internal (within a process’s space) Reclaim memory (read about garbage collection) More dynamic memory allocation? 19 November 2018 CS2051 Lecture 9

More to come: Towards Sharing? OS P2 P3 P1 D1 D2 D3 libc My linux box has ~50 processes running, each with libc (0.6Mb), libX (0.6Mb), libKDE, etc... 19 November 2018 CS2051 Lecture 9