CSCI2413 Lecture 5 Operating Systems Memory Management 1 phones off (please)

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Part IV: Memory Management
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.
Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable supply of ready processes to.
Allocating Memory.
Chapter 7 Memory Management
Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2009, Prentice.
CS 311 – Lecture 21 Outline Memory management in UNIX
Modified from Silberschatz, Galvin and Gagne Lecture 16 Chapter 8: Main Memory.
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
COMP5102/5122 Lecture 4 Operating Systems (OS) Memory Management phones off (please)
Memory Management.
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.
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.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
03/17/2008CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
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 Chapter 3.1 : Memory Management Storage hierarchy Storage hierarchy Important memory terms Important memory terms Earlier memory allocation schemes Earlier.
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
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 Chapter 7.
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.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CY2003 Computer Systems Lecture 09 Memory Management.
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.
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.
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.
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.
2010INT Operating Systems, School of Information Technology, Griffith University – Gold Coast Copyright © William Stallings /2 Memory Management.
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.
Memory Management Chapter 7.
Memory Management Chapter 7.
Memory Allocation The main memory must accommodate both:
Main Memory Management
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 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.
So far… Text RO …. printf() RW link printf Linking, loading
Memory Management-I 1.
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.
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.
Page Main Memory.
Presentation transcript:

CSCI2413 Lecture 5 Operating Systems Memory Management 1 phones off (please)

© De Montfort University, 2004CSCI L52 Lecture Outline Background Memory Types Memory Management.. –Overlays –Swapping Allocation –First fit, Best fit, Worst fit

© De Montfort University, 2004CSCI L53 Background The process scheduling determines –when a process will run The memory manager determines –where a process will run

© De Montfort University, 2004CSCI L54 The problem ! No matter how much memory we install, some programmer will always want to use more!! How do we get a quart into a pint pot ?? Hence, MEMORY Management …

© De Montfort University, 2004CSCI L55 Memory Types –CPU registers –cache on board, or very close to, the microprocessor –Primary or main memory –Read And Write Memory (RAM) or Read Only Memory (ROM) –secondary hard disks or other offline storage devices

© De Montfort University, 2004CSCI L56 Memory Speeds The clock for a 500 MHz processor ticks at a rate of 500 million times per second –each tick takes 2 nanoseconds cache memory, built into the microprocessor, –access time typically a few nanoseconds (around 10 nsec.) Primary memory around nanoseconds Hard disk, about 10 milliseconds or ten million nanoseconds!

© De Montfort University, 2004CSCI L57 Memory Management Requirements Relocation –Programmer does not know where the program will be placed in memory when it is executed –While the program is executing, it may be swapped to disk and returned to main memory at a different location (relocated) –Memory references in the code must be translated to actual physical memory addresses

© De Montfort University, 2004CSCI L58

© De Montfort University, 2004CSCI L59 A Simple Model In the simplest memory management model –one process is in memory at a time that process is allowed to use as much memory as available user program 1 user program 2 operating system 0x0000 0x1000 0xFFFF

© De Montfort University, 2004CSCI L510 Overlays Split the program into small blocks Keep in main only those blocks that are needed at any given time. Needed when process is larger than amount of memory allocated to it.

© De Montfort University, 2004CSCI L511 Overlays … it is possible to increase the amount of memory available through the use of overlays main:initialisation input processing output initialisation main:initialisation input processing output main:initialisation input processing output input main:initialisation input processing output processing main:initialisation input processing output operating system 0x0000 0x1000 0xFFFF

© De Montfort University, 2004CSCI L512 Swapping Moving processes to and fro between main memory and hard disk is called swapping Roll out, roll in – swapping variant used for priority-based scheduling algorithms; lower-priority process is swapped out so higher- priority process can be loaded and executed.

© De Montfort University, 2004CSCI L513 Schematic View of Swapping Main MemoryBacking store Operating Systems Process 1 User Space Process 2 Swap out Swap in

© De Montfort University, 2004CSCI L514 Fixed Partitioning Main memory is divided into equal- (or unequal-) sized partitions and these partitions are assigned to processes. Any program, no matter how small, occupies an entire partition. This is called internal fragmentation. Main memory use is inefficient. The operating system keeps a track of which partitions are being used and which are free –processes are allocated to partitions when free

© De Montfort University, 2004CSCI L515 Dynamic Partitioning Partitions are of variable length and number Process is allocated exactly as much memory as required Eventually get holes in the memory. This is called external fragmentation Must use compaction to shift processes so they are contiguous and all free memory is in one block

© De Montfort University, 2004CSCI L516 Memory Allocation Methods 1. Single Process Systems User Process Operating System Unused Space

© De Montfort University, 2004CSCI L517 Memory Allocation Methods 2. Fixed Partition Memory Operating System Process A 180K Process B 200K Process C 300K 200K 300K 400K 0K 1000K

© De Montfort University, 2004CSCI L518 Memory Allocation Methods 3. Variable Partition Memory Operating System Process A 180K Process B 200K Process C 300K

© De Montfort University, 2004CSCI L519 Contiguous Allocation Main memory usually into two partitions: –Resident operating system, usually held in low memory with interrupt vector. –User processes then held in high memory. contiguous storage –allocates memory only in a single block the memory is in a single, continuous block, with no ‘holes’ or ‘gaps’

© De Montfort University, 2004CSCI L520 Contiguous Allocation … Hole – blocks of memory; holes of various size 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) process 2 process 5 process 9 OS process 2 process 5 OS process 2 process 5 OS process 2 process 5 process 9 OS process 9 process 10

© De Montfort University, 2004CSCI L521 Non-contiguous … Allocate memory in multiple blocks, or segments, which may be placed anywhere in memory –the blocks are not necessarily next to each other –this is called non-contiguous storage allocation

© De Montfort University, 2004CSCI L522 Placement Algorithms Operating system must decide which free block to allocate to a process –First-fit: scan the list segment and choose the block that is closest to the request. –Best-fit: search the entire list and allocate the smallest hole that is big enough; –Worst-fit: allocate the largest hole; must also search entire list. Produces the largest leftover hole.

© De Montfort University, 2004CSCI L523 Example: A variable partition memory has the following hole sizes in memory order: 200K, 600K, 400K, 800K, 350K, 70K A new process of size 300K enters the system. Determine where it will go according to the best-fit, first-fit and worst-fit algorithms and update the hole size status of the memory after the process has been added.

© De Montfort University, 2004CSCI L524 Placement Policies Another Example Hole sizes are: 475K 425K 350K 2 processes of sizes 370K and 100K Best–fit ? First-fit ?

© De Montfort University, 2004CSCI L525 Dynamic relocation using a relocation register

© De Montfort University, 2004CSCI L526 Summary A number of processes can coexist in memory using a variety of allocation techniques and placement policies Main problem is the creation of unusable holes as processes terminate making it sometimes difficult to accommodate new processes Compaction can be used to shuffle processes and create larger more usable space but the large overheads involved make it not always feasible to carry out in real time.