Lecture 10 Page 1 CS 111 Online Memory Management CS 111 On-Line MS Program Operating Systems Peter Reiher.

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Allocating Memory.
CS 311 – Lecture 21 Outline Memory management in UNIX
CS 153 Design of Operating Systems Spring 2015
Chapter 9 – Real Memory Organization and Management
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Understanding Operating Systems1 Operating Systems Virtual Memory Thrashing Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions.
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 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.
Computer Organization and Architecture
Operating System Concepts
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
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.
Tutorial 6 Memory Management
Tutorial 7 Memory Management presented by: Antonio Maiorano Paul Di Marco.
Review of Memory Management, Virtual Memory CS448.
Lecture 7 Page 1 CS 111 Summer 2015 Memory Management CS 111 Operating System Principles Peter Reiher.
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
Ch. 4 Memory Mangement Parkinson’s law: “Programs expand to fill the memory available to hold them.”
CY2003 Computer Systems Lecture 09 Memory Management.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Chapter 8 – Main Memory (Pgs ). Overview  Everything to do with memory is complicated by the fact that more than 1 program can be in memory.
Lecture 11 Page 1 CS 111 Online Memory Management: Paging and Virtual Memory CS 111 On-Line MS Program Operating Systems Peter Reiher.
Chapter 4 Memory Management Virtual Memory.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Operating Systems Lecture 14 Segments Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software Engineering.
Lecture 11 Page 1 CS 111 Online Virtual Memory A generalization of what demand paging allows A form of memory where the system provides a useful abstraction.
Lecture 10 Page 1 CS 111 Online Another Option Fixed partition allocations result in internal fragmentation – Processes don’t use all of the fixed partition.
Lecture 5 Page 1 CS 111 Online Processes CS 111 On-Line MS Program Operating Systems Peter Reiher.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
Lecture 7 Page 1 CS 111 Summer 2013 Another Option Fixed partition allocations result in internal fragmentation – Processes don’t use all of the fixed.
Lecture 4 Page 1 CS 111 Online Modularity and Virtualization CS 111 On-Line MS Program Operating Systems Peter Reiher.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
Lecture 10 Page 1 CS 111 Spring 2015 Memory Management CS 111 Operating Systems Peter Reiher.
Lecture 10 Page 1 CS 111 Fall 2015 Memory Management CS 111 Operating Systems Peter Reiher.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
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.
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.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
Lecture 4 Page 1 CS 111 Online Modularity and Memory Clearly, programs must have access to memory We need abstractions that give them the required access.
Ch. 4 Memory Mangement Parkinson’s law: “Programs expand to fill the memory available to hold them.”
CS703 - Advanced Operating Systems By Mr. Farhan Zaidi.
Lecture 12 Page 1 CS 111 Winter 2014 Memory Management CS 111 Operating Systems Peter Reiher.
Outline What is memory management about? Memory management strategies:
Memory Management.
CSE 120 Principles of Operating
CSC 322 Operating Systems Concepts Lecture - 12: by
Outline Paging Swapping and demand paging Virtual memory.
Memory Management © 2004, D. J. Foreman.
Chapter 9 – Real Memory Organization and Management
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.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Lecture 32 Syed Mansoor Sarwar
CS399 New Beginnings Jonathan Walpole.
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
COMP755 Advanced Operating Systems
Presentation transcript:

Lecture 10 Page 1 CS 111 Online Memory Management CS 111 On-Line MS Program Operating Systems Peter Reiher

Lecture 10 Page 2 CS 111 Online Outline What is memory management about? Memory management strategies: – Fixed partition strategies – Dynamic domains – Buffer pools – Garbage collection – Memory compaction

Lecture 10 Page 3 CS 111 Online Memory Management Memory is one of the key assets used in computing In particular, memory abstractions that are usable from a running program – Which, in modern machines, typically means RAM We have a limited amount of it Lots of processes want to use it How do we manage its use?

Lecture 10 Page 4 CS 111 Online What Is Memory Used For? Anything that a program needs to access – Except control and temporary values, which are kept in registers The code – To allow the process to execute instructions The stack – To keep track of its state of execution The heap – To hold dynamically allocated variables

Lecture 10 Page 5 CS 111 Online Other Uses of Memory The operating system needs memory itself For its own code, stack, and dynamic allocations For I/O buffers To hold per-process control data The OS shares the same physical memory that user processes rely on The OS provides overall memory management

Lecture 10 Page 6 CS 111 Online Aspects of the Memory Management Problem Most processes can’t perfectly predict how much memory they will use The processes expect to find their existing data when they need it where they left it The entire amount of data required by all processes may exceed physical memory Switching between processes must be fast – So you can’t much delay for copying data from one place to another The cost of memory management itself must not be too high

Lecture 10 Page 7 CS 111 Online Memory Management Strategies Fixed partition allocations Dynamic domains Paging Virtual memory We’ll talk about the last two in the next class

Lecture 10 Page 8 CS 111 Online Fixed Partition Allocation Pre-allocate partitions for n processes – Usually one partition per process So n partitions – Reserving space for largest possible process Partitions come in one or a few set sizes Very easy to implement – Common in old batch processing systems – Allocation/deallocation very cheap and easy Well suited to well-known job mix

Lecture 10 Page 9 CS 111 Online Memory Protection and Fixed Partitions Need to enforce the boundaries of each partition To prevent one process from accessing another’s memory Could use hardware similar to domain registers for this purpose On the flip side, hard to arrange for shared memory – Especially if only one segment per process

Lecture 10 Page 10 CS 111 Online Problems With Fixed Partition Allocation Presumes you know how much memory will be used ahead of time Limits the number of processes supported to the total of their memory requirements Not great for sharing memory Fragmentation causes inefficient memory use

Lecture 10 Page 11 CS 111 Online Fragmentation A problem for all memory management systems – Fixed partitions suffer it especially badly Based on processes not using all the memory they requested As a result, you can’t provide memory for as many processes as you theoretically could

Lecture 10 Page 12 CS 111 Online Fragmentation Example Partition 1 8MB Partition 2 4MB Partition 3 4MB process A (6 MB) process B (3 MB) process C (2 MB) waste 2MB waste 1MB Total waste = 2MB + 1MB + 2MB = 5/16MB = 31% Let’s say there are three processes, A, B, and C Their memory requirements: A: 6 MBytes B: 3 MBytes C: 2 MBytes Available partition sizes: 8 Mbytes 4 Mbytes

Lecture 10 Page 13 CS 111 Online Internal Fragmentation Fragmentation comes in two kinds: – Internal and external This is an example of internal fragmentation – We’ll see external fragmentation later Wasted space in fixed sized blocks – The requestor was given more than he needed – The unused part is wasted and can’t be used for others Internal fragmentation can occur whenever you force allocation in fixed-sized chunks

Lecture 10 Page 14 CS 111 Online More on Internal Fragmentation Internal fragmentation is caused by a mismatch between – The chosen sizes of a fixed-sized blocks – The actual sizes that programs use Average waste: 50% of each block Overall waste reduced by multiple sizes – Suppose blocks come in sizes S1 and S2 – Average waste = ((S1/2) + (S2 - S1)/2)/2

Lecture 10 Page 15 CS 111 Online Multiple Fixed Partitions You could allow processes to request multiple partitions – Of a single or a few sizes Doesn’t really help the fragmentation problem – Now there were more segments to fragment – Even if each contained less memory

Lecture 10 Page 16 CS 111 Online Where Was Fixed Partition Allocation Used? Old operating systems from the 1960s – E.g., IBM’s OS 360 and MVT Not required until people wanted to do multiprogramming Not really great even for those environments, so it didn’t last A simple model for very basic multiprogramming

Lecture 10 Page 17 CS 111 Online Summary of Fixed Partition Allocation Very simple Inflexible Subject to a lot of internal fragmentation Not used in many modern systems – But a possible option for special purpose systems, like embedded systems – Where we know exactly what our memory needs will be