Operating System Concepts and Techniques Lecture 9 Memory Management-2 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques,

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

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.
Allocating Memory.
Chapter 7 Memory Management
CS 311 – Lecture 21 Outline Memory management in UNIX
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management - 2 CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
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.
Memory Management Chapter 7 B.Ramamurthy. Memory Management Subdividing memory to accommodate multiple processes Memory needs to allocated efficiently.
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 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.
Chapter 5: Memory Management Dhamdhere: Operating Systems— A Concept-Based Approach Slide No: 1 Copyright ©2005 Memory Management Chapter 5.
Memory ManagementCS-3013 C-term Memory Management CS-3013 Operating Systems C-term 2008 (Slides include materials from Operating System Concepts,
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.
Memory management. Instruction execution cycle Fetch instruction from main memory Decode instruction Fetch operands (if needed0 Execute instruction Store.
Chapter 3 Memory Management: Virtual Memory
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Operating System 7 MEMORY MANAGEMENT. MEMORY MANAGEMENT REQUIREMENTS.
Memory Management Chapter 7.
Dynamic Partition Allocation Allocate memory depending on requirements Partitions adjust depending on memory size Requires relocatable code –Works best.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
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 Chapter 7.
Subject: Operating System.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
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.
Operating System Concepts and Techniques Lecture 8
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
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.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Memory Management Overview.
CS 147 Virtual Memory Prof. Sin Min Lee Anthony Palladino.
Memory Management. Why memory management? n Processes need to be loaded in memory to execute n Multiprogramming n The task of subdividing the user area.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
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.
Operating System Concepts and Techniques Lecture 11 Memory Management-4 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques,
Memory Management Chapter 5 Advanced Operating System.
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.
Memory Management Chapter 7.
Memory Management By: Piyush Agarwal ( ) Akashdeep ( )
ITEC 202 Operating Systems
Memory management.
Paging COMP 755.
Chapter 9 – Real Memory Organization and Management
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 11/17/2018 A. Berrached:CS4315:UHD.
Main Memory Background Swapping Contiguous Allocation Paging
Introduction to Memory Management
Lecture 3: Main Memory.
COMP755 Advanced Operating Systems
Page Main Memory.
Presentation transcript:

Operating System Concepts and Techniques Lecture 9 Memory Management-2 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First ed., iUniverse Inc., To order: or

Multiple Partition MM Multiple partition MM is an extended version of dynamic partition A program can occupy more than one partition of main memory Each module or set of modules can settle in one partition With multiple partition policy comes dynamic linking, or on the fly linking More than one user partition with variable sizes A module could be linked to its calling module the first time it is actually called during run time The called partition need not be adjacent to caller partition To resolve addresses, there is one base address for every linked module, one table of base addresses for every process 2

Multiple Partition MM... Advantages Not all the modules will be used every time a software system is executed. Some modules are error handling that may seldom be used Some modules are so that the execution of one excludes the execution of others Therefore, main memory is used economically Disadvantages Linker has to be on duty during execution of the program Execution time increases 3

Segmentation MM Most data structures of a program are dynamic in size We cannot reserve enough memory for their growth A program’s address space could be considered a collection of separate segments with each segment being able to grow separately With this methodology, code segment, data segment, and stack of procedure calls and return addresses could each form a separate segment We have a two dimensional view, segment number and offset 4

Segmentation MM… The two dimensional view of addresses is transformed to one dimensional view by this memory management and the hardware This is called address translation Perhaps you are familiar with code segment and data segment 5 …. Segment 1 Segment 2 Segment 3 Segment n Offset Program address space

Relocatable Partition MM An extension of dynamic partition memory management Relocation of programs is allowed in this new policy When a program is ready to be loaded, if there is no qualified partition, but the total size of all free partitions combined is as large as the size of program, all processes are moved to one end of main memory Base address of programs are adjusted We have to avoid frequent relocation Advantages This policy eliminates external fragmentation Very good for small size memories Disadvantage Relocation imposes high overhead 6

Page Memory Management The executable code is chopped up into small equal sized pieces called page Starting from the beginning, pages are numbered from zero on Main memory is also divided into holes of equal sizes called page frames Starting from the beginning, pages frames are numbered from zero on The size of pages and page frames are equal and it is a power of two kilobytes, 1K, 2K, 4K,... 7

Pages and page frames 8 Page frame 0 Page frame 6 (a) Main memory (b) A program Page 0 Page 11

Page table During the loading of program a page table is produced; it shows what page is in what page frame Page table is used for address translation Page no. Page frame no. Page table of a four-page program

Address translation After load, the execution of program is started without any address adjustment Every address generated by program, called logical address, has to be translated to a physical address Address translation is performed by a hardware called memory management unit If a page size is say 2K, address format is … … Page number Byte within page

Address translation… Address translation The details will be explained later 11 Page number Offset Page frame number Offset Logical address Physical address A fast memory module Offset is directly copied from logical address to physical address Memory management unit

Page size Big page size increases internal fragmentation On the average, every program wastes half a page Small page size increases page table size For every page there is one row of page table Somehow we have to minimize memory waste 12

Optimal page size Memory waste for every program is Taking its derivative with respect to p and setting it equal to zero, we get Or, where p is the page size in bytes We refine the page size to be a power of 2 in kilo bytes 13

Page MM adv./disadv. Advantages Eliminates external Fragmentation Disadvantages Overhead due to address translation Memory waste Program size restriction 14

Summary The excellent idea of dynamic link library has evolved from multiple partition MM There are MM policies which are not used for contemporary computers with excellent performance in special environments Relocatable partition MM is often used to manage small size data structures Page MM is the basis for today’s virtual memory In this lecture we studied some non-virtual memory MM policies which support multiprogramming I cannot imagine hundreds of computers that control a sophisticated airplane useing virtual memory 15

16 Find out What exactly is the difference between logical and physical addresses The difficulties in having pages that are not a power of two kilobytes Why the size of almost everything a power of two The worst page size in page MM Ways to keep track of available pages of main memory How we can remove all pages of a terminated program from main memory How the page concept could be used within segmentation MM

17 Any questions?