Operating System Concepts and Techniques Lecture 8

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Understanding Operating Systems Fifth Edition
Memory Management Chapter 7.
Fixed/Variable Partitioning
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
7. Physical Memory 7.1 Preparing a Program for Execution
Allocating Memory.
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.
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.
Chapter 7 Memory Management
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
CSCI2413 Lecture 5 Operating Systems Memory Management 1 phones off (please)
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Friday, June 30, 2006 "Man's mind, once stretched by a new idea, never regains its original dimensions." - Oliver Wendell Holmes, Jr.
Memory Management Chapter 5.
Memory Management Five Requirements for Memory Management to satisfy: –Relocation Users generally don’t know where they will be placed in main memory May.
 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 2 Memory Management: Early Systems (all ancient history)
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.
Operating System 7 MEMORY MANAGEMENT. MEMORY MANAGEMENT REQUIREMENTS.
Memory Management Chapter 7.
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
Chapter 7 Memory Management Seventh Edition William Stallings Operating Systems: Internals and Design Principles.
1. Memory Manager 2 Memory Management In an environment that supports dynamic memory allocation, the memory manager must keep a record of the usage of.
Chapter 2 Memory Management: Early Systems Understanding Operating Systems, Fourth Edition.
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.
Chapter 2 Memory Management: Early Systems Understanding Operating Systems, Fourth Edition.
Memory Management Chapter 7.
Subject: Operating System.
1 Memory Management Requirements of memory management system to provide the memory space to enable several processes to execute concurrently to provide.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Memory Management Basics. 2 Program P Basic Memory Management Concepts Address spaces Physical address space — The address space supported by the hardware.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
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.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
© 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.
Operating Systems Lecture 31.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Operating System Concepts and Techniques Lecture 9 Memory Management-2 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques,
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.
Operating Systems Lecture 31 Syed Mansoor Sarwar.
Fall 2000M.B. Ibáñez Lecture 14 Memory Management II Contiguous Allocation.
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.
Main Memory CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
MEMORY MANAGEMENT. memory management  In a multiprogramming system, in order to share the processor, a number of processes must be kept in memory. 
CompSci 143A1 Part II: Memory Management Chapter 7: Physical Memory Chapter 8: Virtual Memory Chapter 9: Sharing Data and Code in Main Memory Spring, 2013.
COMP 3500 Introduction to Operating Systems Memory Management: Part 2 Dr. Xiao Qin Auburn University Slides.
ITEC 202 Operating Systems
Main Memory Management
Module IV Memory Organization.
Chapter 8: Main Memory.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
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
COMP755 Advanced Operating Systems
Presentation transcript:

Operating System Concepts and Techniques Lecture 8 Memory Management-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First ed., iUniverse Inc., 2011. To order: www.iUniverse.com, www.barnesandnoble.com, or www.amazon.com

Memory Management (MM) Memory management policies and techniques have tremendously changed throughout the years The simplest being single contiguous partition memory management The most complex being multilevel-page table virtual memory with cache A Brief list follows

A Brief list of MM policies Old policies Single contiguous partition MM Static partition MM Dynamic partition MM Multiple partition MM Middle age policies Segmentation MM Relocatable partition MM Page (non-virtual memory) MM Virtual memory policies Page-based virtual memory MM Multilevel page table page-based virtual memory MM

Single contiguous partition MM MM is divided into two parts One part for operating system The other is called user memory So simple that there is no MM subsystem, loader takes care of it Make sure user program does not destroy OS Many disadvantages Supports only single-programming System utilization is very low Waste of memory for small programs A program larger than the user’s main memory will not be able to run

Static Partition MM More than one user partition with fixed sizes Sizes are different to reduce memory waste and accept larger programs Make sure user programs do not interfere and do not destroy OS Number of partitions determines degree of multiprogramming Advantages Simple to implement; a table for partitions information Multiprogramming is possible the size of runable programs limited to the largest partition size Memory waste A program larger than users main memory will not be able to run

Dynamic Partition MM More than one user partition with variable sizes Sizes are different to reduce memory waste and accept larger programs Make sure user programs do not interfere and do not destroy OS Number of partitions determines the degree of multiprogramming At start there is only one big free partition When new programs are accepted new partitions are created Upon program completion free neighbor partitions can join Advantages Simple to implement; two tables, free and allocated partitions Multiprogramming is possible The size of a runable programs limited to the size of user memory A program larger than users main memory will not be able to run

Dynamic Partition Memory waste There is a smallest memory allocation unit, usually 1K bytes A program which is 1025 bytes will be given 2K bytes, 1023 bytes are wasted in the form of internal fragmentation We are not allowed to relocate programs External fragmentation occurs when all free memory partitions combined are large enough to load the coming program into, but these spaces do not form a contiguous partition and each one cannot accept the coming program

Dynamic Partition Memory waste… The 50% rule: Without other information, on the average, the number of free partitions is half the number of allocated partitions Remember: adjacent free partitions join, but adjacent occupied partitions house different programs Let C = (average free partition size)/(average program size), then external fragmentation fraction=

Partition allocation First-Fit Next-Fit Best-Fit Worst-Fit Look at the free partitions data structure (not the main memory itself) and select the first which is as large as the program Next-Fit From partitions data structure, from where the pointer points, select the first which is as large as the program Best-Fit pick a qualified partition whose size is closest to the size of the program Worst-Fit Pick the largest free partition

Partition allocation- Buddy syatem The size of a partition is 2i*m A partition size of 2i*K could split into two size 2i-1*K which are called buddies Remember that any two partition of size 2i*m are not buddies even if they are adjacent A complete partition is given to a program Remember partitions cannot start from any arbitrary address A program the size of xK is given a partition of size 2i*K, where 2i  x and i is the smallest such integer Any two free buddies have to merge

Buddy system tree 512M 256M 128M 64M 32M : Processed : Allocated : Available Figure shows certain state of a small 512 Mega Bytes (MB) main memory. A black circle represents a partition that has been broken and no longer exists. Dark circles represent a partition that is occupied by a program. An unfilled circle represents a free (available) partition Advantage: easy to find a partition for a program Disadvantage: Internal fragmentation increases

Summary There are variety of memory management The simplest, single contiguous memory management The most complex, multilevel page table page-based virtual memory with segmentation and cache memory Older managements are good for special purpose computer such as embedded control systems and intelligent machinery electronics This lecture introduced static and dynamic partition memory managements Base register is a central concept to dynamic partition MM

Find out What the degree of multiprogramming is in your computer Practical systems which use single partition MM If we can have a buddy system in which buddies are not the same size In buddy system, why can’t any two adjacent partitions the size of 2i*K, join to form a partition the size of 2i+1*K In what situations worst-fit will perform better than other partition selection algorithms

Any questions?