Basic Memory Management 1. Readings r Silbershatz et al: chapters 8.1-8.3 2.

Slides:



Advertisements
Similar presentations
Chapter 7 Memory Management
Advertisements

Basic Memory Management 1. Readings r Silbershatz et al: chapters
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
Memory Management. Managing Memory … The Simplest Case The O/S User Program 0 0xFFF … * Early PCs and Mainframes * Embedded Systems One user program at.
Chapter 7 Memory Management
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)
Module 3.0: Memory Management
CS 104 Introduction to Computer Science and Graphics Problems
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 Chapter 5.
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.
Memory Management Five Requirements for Memory Management to satisfy: –Relocation Users generally don’t know where they will be placed in main memory May.
Operating System Concepts
Silberschatz, Galvin and Gagne  Operating System Concepts Multistep Processing of a User Program User programs go through several steps before.
Chapter 7 Memory Management
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
1 Memory Management Chapter 7. 2 Roadmap n Memory management u Objectives u Requirements n Simple memory management u Memory partitioning F Fixed partitioning.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Swapping and Contiguous Memory Allocation. Multistep Processing of a User Program User programs go through several steps before being run. Program components.
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.
MEMORY MANAGEMENT Presented By:- Lect. Puneet Gupta G.P.C.G. Patiala.
1 Memory Management (a). 2 Background  Program must be brought into memory and placed within a process for it to be run.  Input queue – collection of.
Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Dr.
Chapter 7 Memory Management
Chapter 7 Memory Management Seventh Edition William Stallings Operating Systems: Internals and Design Principles.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
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 Chapter 7.
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.
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.
1 Memory Management Chapter 8. 2 Memory Management n It is the task carried out by the OS and hardware to accommodate multiple processes in main memory.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual 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 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Memory Management Chapter 5 Advanced Operating System.
1 Memory Management n In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes.
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 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Memory Management Chapter 7.
Chapter 7 Memory Management
Memory Management Chapter 7.
Chapter 2 Memory and process management
Chapter 8: Main Memory.
Chapter 8 Main Memory.
Main Memory Management
Multistep Processing of a User Program
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.
Operating Systems: Internals and Design Principles, 6/E
Presentation transcript:

Basic Memory Management 1

Readings r Silbershatz et al: chapters

Outline r Memory Hierarchy r Memory management requirements r Basic memory management r Fixed Partitions r Dynamic Partitions 3

Introduction r Our machines today have 10,000 times more memory than the IBM 7094 – leading edge machine of the 1960’s r Cost of memory has dropped dramatically r Bill Gates (former chair of Microsoft) once said “640K should be enough” 4

Introduction r Software tends to expand to fill the memory available r Technology does not allow for each program to have infinitely large and fast memory r Operating systems must manage memory 5

Instruction-Execution Cycle r You can think of memory as a large array of bytes m Each byte has its own address r Fetch an instruction from memory r Instruction is decoded m May cause operands to be fetched from memory r After instruction execution m Results may be stored back in memory r Each of these operations require memory addresses 6

Registers On-chip Cache Main Memory Magnetic (Hard) Disk Memory Hierarchy r Registers built into the CPU are generally accessible within one cycle of the CPU clock r Completing a memory access may take many cycles of the CPU clock 7

Memory Hierarchy r A processor waiting for data from main memory is not desired r Remedy: Add fast memory between the CPU and main memory called a cache 8

Address Binding r Program execution requires that a program be brought into memory from the disk r The process can reside in any part of the physical memory r Address space starts at but the first address of a user need not be

Address Binding r Addresses in source program are generally symbolic e.g., count r Compiler will bind these symbolic addresses to relocatable addresses m Example: “14 bytes from the beginning of this module” r Binding to physical addresses is typically delayed until run-time 10

Address Binding r Programmer does not know where the program will be placed in memory when it is executed r While the program is executing, it may be placed in disk and returned to main memory at a different location (swapping) r Memory references in the code (virtual or logical) must be translated to actual physical memory addresses r Run-time Mapping from virtual to physical addresses is done by a hardware device called the memory-management unit (MMU) 11

Simple MMU r Simple mapping r Relocation register: Value is added to every address generated by a user process 12

Contiguous Memory Allocation r We will start out with the most basic method used that allows multiple processes to reside in memory r With contiguous memory allocation each process is contained in a single section of memory that is contiguous 13

Fixed Partitioning r Main memory use is inefficient. r Any program, no matter how small, occupies an entire partition. m This is internal fragmentation. 8 M Operating System 14

Fixed Partitioning r Unequal-size partitions m Lessens the problem with equal-size partitions Operating System 8 M 12 M 8 M 6 M 4 M 2 M 15

Placement Algorithm with Partitions r Equal-size partitions m Since all partitions are of equal size, it does not matter which partition is used r Unequal-size partitions m Each process can be assigned to the smallest partition within which it will fit 16

One Process Queue per Partition New Processes Operating System 17

One Common Process Queue r When its time to load a process into main memory the smallest available partition that will hold the process is selected Operating System New Processes 18

Questions r Single Queue: m What is the problem with taking the first job that fits into the partition? m What is the problem with taking the largest job that fits into the partition? r Multiple Queues: m What is the disadvantage? 19

Multiprogramming with Fixed Partitions r Was used by OS/360 on large IBM mainframes for many years r Incoming jobs were queued until a suitable partition was available r Today no modern OS uses fixed partitions 20

Dynamic Partitioning r Partitions are of variable length and number r Process is allocated exactly as much memory as required r Eventually get holes in the memory. This is called external fragmentation r Compaction is required to obtain a large block at the end of memory m Shift processes so they are contiguous and all free memory is in one block 21

Example Dynamic Partitioning Operating System Process K Process 2 Process K 288 K 64 K Operating System Process K Process K 288 K 64 K Operating System Process K Process 3288 K 64 K Process K 96 K 22

Example Dynamic Partitioning Operating System 320 K Process 3288 K 64 K Process K 96 K Operating System Process 3288 K 64 K Process K 96 K Process 2224 k 96 K 23

Dynamic Partitioning Placement Algorithm r Operating system must decide which free block to allocate to a process r Best-fit algorithm m Choose the block that is closest in size to the request m This has the worst overall performance m The smallest block is found for a process The smallest amount of fragmentation is left; Memory compaction must be done more often 24

Dynamic Partitioning Placement Algorithm r First-fit algorithm m Starts scanning memory from the beginning and chooses the first available block that is large enough. r Next-fit m Starts scanning memory from the location of the last placement and chooses the next available block that is large enough 25

Summary r This section studied basic memory allocation techniques 26