0% found this document useful (0 votes)
9 views

lecture 6

Memory management is crucial for efficient allocation and deallocation of limited main memory among competing processes. It involves strategies such as fetching, placement, and replacement, and can be categorized into contiguous and non-contiguous schemes, with techniques like fixed and dynamic partitioning, paging, and segmentation. Effective memory management ensures optimal use of memory, protects processes from corruption, and allows for multiprogramming.

Uploaded by

mugerwasamuel8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

lecture 6

Memory management is crucial for efficient allocation and deallocation of limited main memory among competing processes. It involves strategies such as fetching, placement, and replacement, and can be categorized into contiguous and non-contiguous schemes, with techniques like fixed and dynamic partitioning, paging, and segmentation. Effective memory management ensures optimal use of memory, protects processes from corruption, and allows for multiprogramming.

Uploaded by

mugerwasamuel8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

MEMORY MANAGEMENT

• Memory is the important part of the computer that is used to store the data. Its
management is critical to the computer system because the amount of main
memory available in a computer system is very limited. At any time, many
processes are competing for it. Moreover, to increase performance, several
processes are executed simultaneously. For this, we must keep several processes
in the main memory, so it is even more important to manage them effectively.
• What is meant by memory management?
• Refers to the efficient allocation and deallocation of memory to
processes.
MEMORY MANAGEMENT
Role of Memory management

• Memory manager is used to keep track of the status of memory locations, whether it
is free or allocated. It addresses primary memory by providing abstractions so that
software perceives a large memory is allocated to it.
• Memory manager permits computers with a small amount of main memory to
execute programs larger than the size or amount of available memory. It does this by
moving information back and forth between primary memory and secondary memory
by using the concept of swapping.
• The memory manager is responsible for protecting the memory allocated to each
process from being corrupted by another process. If this is not ensured, then the
system may exhibit unpredictable behavior.
• Memory managers should enable sharing of memory space between processes. Thus,
two programs can reside at the same memory location although at different times
MEMORY MANAGEMENT STRATEGIES

FETCH STARTEGY : This strategy determines how data is brought into the main
memory (RAM) from secondary storage (like hard drives or SSDs)
PLACEMENT STRATEGY: This strategy decides where in the main memory to place
the fetched data
REPLACEMENT STRATEGY: This strategy determines which data to remove from
the main memory when it's full and new data needs to be fetched.
Memory Management
Techniques
• The memory management techniques can be classified into following main categories:
• Contiguous memory management schemes: refers to a set of techniques used in computer
operating systems to allocate memory to processes in a contiguous manner.
NB: Contiguous it refers to memory blocks that are located next to each other(connected to each
other), without any gaps or interruptions
• Non-Contiguous memory management schemes: are techniques used to allocate memory to
processes in a non-contiguous manner. This means that the memory allocated to a process can be
fragmented into multiple non-adjacent blocks
NB:non-contiguous means not connected or not together. In computer memory, it means memory
that's not all in one piece, but scattered around.
Memory Management Techniques
Contiguous memory
management schemes
• In a Contiguous memory management scheme, each program
occupies a single contiguous block of storage locations, i.e., a set of
memory locations with consecutive addresses.
• Single contiguous memory management schemes:
• The Single contiguous memory management scheme is the simplest
memory management scheme used in the earliest generation of
computer systems. In this scheme, the main memory is divided into
two contiguous areas or partitions. The operating systems reside
permanently in one partition, generally at the lower memory, and the
user process is loaded into the other partition.
Contiguous memory
management schemes
• Multiple Partitioning:
The single Contiguous memory management scheme is inefficient as it
limits computers to execute only one program at a time resulting in
wastage in memory space and CPU time. The problem of inefficient CPU
use can be overcome using multiprogramming that allows more than one
program to run concurrently. To switch between two processes, the
operating systems need to load both processes into the main memory.
The operating system needs to divide the available main memory into
multiple parts to load multiple processes into the main memory. Thus
multiple processes can reside in the main memory simultaneously.
Contiguous memory
management schemes
Single Partitioning Multiple Partitioning
multiple partitioning
• The multiple partitioning schemes can be of two types:
• Fixed Partitioning
• Dynamic Partitioning
Fixed Partitioning
• Fixed Partitioning
• The main memory is divided into several fixed-sized partitions in a fixed partition
memory management scheme or static partitioning. These partitions can be of the
same size or different sizes. Each partition can hold a single process. The number of
partitions determines the degree of multiprogramming, i.e., the maximum number of
processes in memory. These partitions are made at the time of system generation and
remain fixed after that.
• When a process is loaded into a partition, it may not fully utilize the entire partition.
• This results in unused memory within the partition, known as internal fragmentation.
• This unused memory cannot be allocated to other processes, leading to inefficient
memory utilization
Dynamic Partitioning

• The dynamic partitioning was designed to overcome the problems of a


fixed partitioning scheme. In a dynamic partitioning scheme, each
process occupies only as much memory as they require when loaded for
processing. Requested processes are allocated memory until the entire
physical memory is exhausted or the remaining space is insufficient to
hold the requesting process. In this scheme the partitions used are of
variable size, and the number of partitions is not defined at the system
generation time.
• Advantages of Dynamic Partitioning memory management schemes:
• Simple to implement.
• Easy to manage and design
Fixed Partitioning VS Dynamic
Partitioning
Fixed Partitioning Dynamic Partitioning
Non-Contiguous memory management schemes

• Non-Contiguous memory management schemes are divided into


types :
Paging
Segmentation
PAGING

Paging: A memory management technique that divides memory into fixed-


sized blocks called pages.
In Operating Systems, Paging is a storage mechanism used to retrieve processes
from the secondary storage into the main memory in the form of pages.
The main idea behind the paging is to divide each process in the form of pages.
The main memory will also be divided in the form of frames.
One page of the process is to be stored in one of the frames of the memory.
The pages can be stored at the different locations of the memory but the
priority is always to find the contiguous frames or holes.
Pages of the process are brought into the main memory only when they are
required otherwise they reside in the secondary storage
EXAMPLE
Let us consider the main memory size 16 Kb
and Frame size is 1 KB therefore the main
memory will be divided into the collection of
16 frames of 1 KB each.
There are 4 processes in the system that is
P1, P2, P3 and P4 of 4 KB each. Each process
is divided into pages of 1 KB each so that one
page can be stored in one frame.
Initially, all the frames are empty therefore
pages of the processes will get stored in the
contiguous way.
Frames, pages and the mapping between the
two is shown in the image below
Segmentation in OS

• In Operating Systems, Segmentation is a memory management


technique in which the memory is divided into the variable size parts.
Each part is known as a segment which can be allocated to a process.
• The details about each segment are stored in a table called a segment
table. Segment table is stored in one (or many) of the segments
Segmentation in OS

You might also like