lecture 6
lecture 6
• 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