Module IV Memory Organization.

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

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
Chapter 2: Memory Management, Early Systems
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.
Chapter 7 Memory Management
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Chapter 3.1 : Memory Management
Understanding Operating Systems1 Operating Systems Virtual Memory Thrashing Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions.
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.
Chapter 7 Memory Management
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.
Memory Management Chapter 7.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
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 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.
1. Memory Manager 2 Memory Management In an environment that supports dynamic memory allocation, the memory manager must keep a record of the usage of.
CY2003 Computer Systems Lecture 09 Memory Management.
Memory Management Chapter 7.
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.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
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 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.
1 Memory Management n In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes.
Ch. 4 Memory Mangement Parkinson’s law: “Programs expand to fill the memory available to hold them.”
Fall 2000M.B. Ibáñez Lecture 14 Memory Management II Contiguous Allocation.
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.
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 One of the most important OS jobs.
Memory Management Chapter 7.
Chapter 7 Memory Management
Memory Management Chapter 7.
Memory Management.
ITEC 202 Operating Systems
Chapter 2 Memory and process management
Day 19 Memory Management.
Day 19 Memory Management.
Memory management.
Memory Allocation The main memory must accommodate both:
Chapter 9 – Real Memory Organization and Management
Day 18 Memory Management.
Main Memory Management
Chapter 8: Main Memory.
Unit 6: Real Memory organization management
Memory Management.
Chapter3 Memory Management Techniques
Main Memory Background Swapping Contiguous Allocation Paging
Lecture 3: Main Memory.
Operating System Chapter 7. Memory Management
Memory Management (1).
Operating Systems: Internals and Design Principles, 6/E
Presentation transcript:

Module IV Memory Organization

Contiguous Memory Allocation In contiguous memory allocation, the memory is divided into two partitions: one for OS and other for user processes.

Contiguous Memory Allocation Advantages It is simple. It is easy to understand and use. Disadvantages It leads to poor utilization of processor and memory. Users job is limited to the size of available memory.

Partitioning It involves splitting of memory into sections to allocate processes including operating system. There are two schemes for partitioning: Fixed size partitions Variable size partitions

Fixed Size Partitions The memory is partitioned to fixed size partition. They are of two types : Fixed Equal-size Partitions Fixed Variable Size Partitions

Fixed Equal-size Partitions It divides the main memory into equal number of fixed sized partitions OS occupies some fixed portion and remaining portion is for user processes.

Fixed Equal-size Partitions Advantages Any process whose size is ≤ partition size can be loaded into any available partition. It supports multiprogramming. Disadvantages If a program is too big to fit into a partition, overlay technique is used Memory use is inefficient if block of data to be loaded is small. (If a partition is of 1M,remaining 7M cannot be used) It is known as Internal Fragmentation.

Fixed Variable Size Partitions By using fixed variable size partitions, we can overcome some of the disadvantages present in fixed equal size partitioning. 

Fixed Variable Size Partitions Disadvantage There is a problem of wastage of memory. For example, a process that requires 4MB of memory would be placed in the 5MB partition which is the smallest available partition. In this partition, only 4MB is used, the remaining 1MB cannot be used by any other process, so it is wastage.

Fixed-sized Partitions Degree of multiprogramming is bound by the number of partitions. When a partition is free, a process is selected from input queue and is loaded into it. When the process terminates, the partition becomes available.

Dynamic Partitioning In this method, the partitions are of variable length and number. When a process is brought into main memory, it is allocated exactly as much memory as it requires and no more. Initially it seems that there will be only one hole at the end, so the waste is less. But as swap- out and swap-in occurs, then more and more hole will be created, which will lead to more wastage of memory.

Dynamic Partitioning Consider a main memory of 2MB out of which 512KB is used by the Operating System.

Dynamic Partitioning Consider 3 processes of size 425KB, 368KB and 470-KB  loaded into the memory. This leaves a hole at end, which is too small for a 4th process.

Dynamic Partitioning The fourth process is of 320KB and OS swaps out process2, which leaves sufficient room for new process. Since process-4 is smaller than process-2, another hole is created

Dynamic Partitioning Later when process 2 is ready, process-1 is swapped out and process-2 is swapped in there. It will create another hole. In this way lot of small holes is created which leads to memory wastage.

Dynamic Partitioning When a process is allocated space, it is loaded into memory When a process terminates, it releases its memory to fill it with another process from the input queue. The new hole could be used for a new processes which leads to dynamic storage allocation The commonly used solutions are the first-fit, best-fit, and worst-fit strategies

Memory Allocation Policies First fit. Allocate the first hole that is big enough. Start searching at the beginning of the set of holes or at the location where the previous search ended. Stop searching as a large enough free hole is found Best fit. Allocate the smallest hole that is big enough. Search the entire list, unless the list is ordered by size. This strategy produces the smallest leftover hole.

Memory Allocation Policies Worst fit. Allocate the largest hole. Again, we must search the entire list, unless it is sorted by size. This strategy produces the largest leftover hole

First Fit Algorithm

First Fit Algorithm The Internal fragmentation is 35K

Best Fit Algorithm

Best Fit Algorithm The Internal fragmentation is 30K

Worst Fit Algorithm

Problem Given memory partitions of 100K, 500K, 200K, 300K and 600K (in order), how would each of first fit, best fit and worst fit algorithms place processes of 212K , 417K , 112K and 426K

Solution : First Fit 100K 500K 200K 300K 600K 212K 112K 417K 426K cannot be kept in any partition

Solution : Best Fit 100K 500K 200K 300K 600K 417K 112K 212K 426K

Solution : Worst Fit 100K 500K 200K 300K 600K 417K 112K 212K 426K cannot be kept in any partition