Memory Allocation The main memory must accommodate both:

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Part IV: Memory Management
Memory management In a multiprogramming system, in order to share the processor, a number of processes must be kept in memory. Memory management is achieved.
Chapter 6: 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.
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: 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)
Chapter 3.1 : Memory Management
Memory Management Chapter 5.
Silberschatz, Galvin and Gagne  Operating System Concepts Multistep Processing of a User Program User programs go through several steps before.
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.
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.
Memory Management Chapter 7.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
Subject: Operating System.
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.
Contiguous Memory Allocation Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.
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 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. memory management  In a multiprogramming system, in order to share the processor, a number of processes must be kept in memory. 
Memory Management Chapter 7.
Chapter 7 Memory Management
Memory Management Chapter 7.
Memory Management By: Piyush Agarwal ( ) Akashdeep ( )
Memory Management.
ITEC 202 Operating Systems
Chapter 2 Memory and process management
Memory management.
Chapter 9 – Real Memory Organization and Management
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.
Chapter 8: Main Memory.
Operating System Concepts
Chapter 8: Main Memory.
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
Unit 6: Real Memory organization management
Memory Management.
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.
Chapter3 Memory Management Techniques
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.
Lecture 3: Main Memory.
Operating System Chapter 7. Memory Management
Memory Management (1).
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.
Chapter 8: Main Memory.
Page Main Memory.
Presentation transcript:

Memory Allocation The main memory must accommodate both: the operating system and the various user processes. in the most efficient way possible. Memory allocation is needed: When the program loads first to the Memory Also reallocation is needed for swapped processes. Finally deallocation is needed for the terminated processes.

Memory Allocation Types Contiguous Memory Allocation - One process – One piece of memory. Single Partition Allocation. Multiple Partition Allocation Fixed size partitioning (equal size, unequal size) Dynamic Partitioning Non Contiguous Memory Allocation - One process – Many pieces of memory. Paging Segmentation

Single Partition Allocation The memory is usually divided into two partitions: one for the resident operating system, and one for the user processes. Since the interrupt vector is often in low memory, programmers usually place the operating system in low memory as well Old MSDOS used this allocation scheme. Single

Multiple-Partition allocation could be done by We usually want several user processes to reside in memory at the same time. In this contiguous memory allocation, each process is contained in a single contiguous section of memory. Multiple-Partition allocation could be done by Fixed Partitioning (Partition sizes are predefined) Dynamic Partitioning (Partition sizes are dynamically changed)

When a partition is free, a process is selected from the input queue and is loaded into the free partition. When the process terminates, the partition becomes available for another process. This method was originally used by the IBM 0S/360 operating system; it is no longer in use.

The memory allocated to a process may be slightly larger than the requested memory. The free fragment after process allocation is internal fragmentation - memory that is internal to a partition but is not being used.

Dynamic Partitioning Degree of multiprogramming limited by number of partitions Hole – block of available memory; holes of various size are scattered throughout memory When a process arrives, it is allocated memory from a hole large enough to accommodate it Process exiting frees its partition, adjacent free partitions combined Operating system maintains information about: a) allocated partitions b) free partitions (hole) This procedure is a particular instance of the general dynamic storage allocation problem, which is how to satisfy a request of size n from a list of free holes.

Dynamic Storage Allocation Algorithms Best fit: Allocate the smallest hole that is big enough. The best-fit strategy will allocate 12KB of the 13KB block to the process. We must search the entire list, unless the list is ordered by size. (slow search). This strategy produces the smallest leftover hole (external fragment).

Dynamic Storage Allocation Algorithms Worst fit: Allocate the largest hole. The idea is that this placement will create the largest hole after the allocations, thus increasing the possibility that, compared to best fit, another process can use the remaining space. Using the same example as above, worst fit will allocate 12KB of the 19KB block to the process, leaving a 7KB block for future use. Again, we must search the entire list, unless it is sorted by size. This strategy produces the largest leftover hole, which may be more useful than the smaller leftover hole from a best-fit approach.

Dynamic Storage Allocation Algorithms First fit: Allocate the first hole that is big enough. (to be fast) Using the same example as above, first fit will allocate 12KB of the 14KB block to the process. Searching can start either at the beginning of the set of holes or at the location where the previous first-fit search ended. We can stop searching as soon as we find a free hole that is large enough.

Dynamic Storage Allocation Algorithms Simulations have shown that both first fit and best fit are better than worst fit in terms of decreasing time and storage utilization. Neither first fit nor best fit is clearly better than the other in terms of storage utilization, but first fit is generally faster. No matter which algorithm is used (first fit, best fit, worst fit), however, external fragmentation will be a problem. Sometimes it could reach the 33% of whole memory.

Dynamic Storage Allocation Algorithms The solution of fragmentation could be: Do memory compaction at runtime (could be complex and expensive taking much runtime). The same fragmentation problem exists when the process is swapped out to the backing store. There compaction is impossible due to slowness. To permit the logical address space of the processes to be noncontiguous Two complementary techniques achieve this solution: paging and segmentation These techniques can also be combined.