Page 1
Memory
Management
Page 2
Memory
Management
I n t r o d u c t i o n
Memory management is the
process of controlling and
coordinating computer memory,
allocating it to processes, and
ensuring efficient utilization.
It serves as the backbone of
modern operating systems,
enabling multiple processes to
run concurrently while
maintaining system stability.
The key functions of memory
management include allocation
of memory to processes,
deallocation when processes
terminate, protection against
unauthorized access, and
controlled sharing among
processes.
These functions work together to
overcome challenges such as
limited memory size, concurrent
access requirements, and the
need for efficient utilization and
speed.
Page 3
Memory
Management
I n t r o d u c t i o n
Memory management is the
process of controlling and
coordinating computer memory,
allocating it to processes, and
ensuring efficient utilization.
It serves as the backbone of
modern operating systems,
enabling multiple processes to
run concurrently while
maintaining system stability.
The key functions of memory
management include allocation
of memory to processes,
deallocation when processes
terminate, protection against
unauthorized access, and
controlled sharing among
processes.
These functions work together to
overcome challenges such as
limited memory size, concurrent
access requirements, and the
need for efficient utilization and
speed.
Memory Hierarchy
1
Registers
Fastest, smallest memory located inside the CPU (typically 32-64 bytes). Provides immediate
access to data being processed.
2
Cache
Fast, small memory close to CPU (KB-MB). Stores frequently accessed data to reduce
CPU waiting time.
3
Main Memory (RAM)
Moderate speed, larger capacity (GB). Primary working memory for running
applications.
4
Secondary Storage
Slow, large, persistent storage (HDD/SSD, TB). Retains data when
power is off.
The memory hierarchy balances speed and cost while providing fast access to frequently used data. Data moves between levels based on usage
patterns through processes like caching and swapping, optimizing overall system performance.
Page 4
Memory
Management
I n t r o d u c t i o n
Memory management is the
process of controlling and
coordinating computer memory,
allocating it to processes, and
ensuring efficient utilization.
It serves as the backbone of
modern operating systems,
enabling multiple processes to
run concurrently while
maintaining system stability.
The key functions of memory
management include allocation
of memory to processes,
deallocation when processes
terminate, protection against
unauthorized access, and
controlled sharing among
processes.
These functions work together to
overcome challenges such as
limited memory size, concurrent
access requirements, and the
need for efficient utilization and
speed.
Memory Hierarchy
1
Registers
Fastest, smallest memory located inside the CPU (typically 32-64 bytes). Provides immediate
access to data being processed.
2
Cache
Fast, small memory close to CPU (KB-MB). Stores frequently accessed data to reduce
CPU waiting time.
3
Main Memory (RAM)
Moderate speed, larger capacity (GB). Primary working memory for running
applications.
4
Secondary Storage
Slow, large, persistent storage (HDD/SSD, TB). Retains data when
power is off.
The memory hierarchy balances speed and cost while providing fast access to frequently used data. Data moves between levels based on usage
patterns through processes like caching and swapping, optimizing overall system performance.
Types of Memory Allocation
Contiguous Allocation
Process occupies a single contiguous block of memory.
This approach includes fixed partitioning, where memory is
divided into predetermined blocks, and dynamic
partitioning, where memory is allocated based on process
needs.
Non-Contiguous Allocation
Process memory is spread across non-adjacent locations.
This includes techniques like paging and segmentation,
which allow more flexible memory utilization.
Memory allocation strategies aim to minimize fragmentation and optimize memory usage. Internal fragmentation occurs
when there is wasted space within allocated memory (common in fixed partitions), while external fragmentation refers to
wasted space between allocated blocks (typical in dynamic partitioning).
Page 5
Memory
Management
I n t r o d u c t i o n
Memory management is the
process of controlling and
coordinating computer memory,
allocating it to processes, and
ensuring efficient utilization.
It serves as the backbone of
modern operating systems,
enabling multiple processes to
run concurrently while
maintaining system stability.
The key functions of memory
management include allocation
of memory to processes,
deallocation when processes
terminate, protection against
unauthorized access, and
controlled sharing among
processes.
These functions work together to
overcome challenges such as
limited memory size, concurrent
access requirements, and the
need for efficient utilization and
speed.
Memory Hierarchy
1
Registers
Fastest, smallest memory located inside the CPU (typically 32-64 bytes). Provides immediate
access to data being processed.
2
Cache
Fast, small memory close to CPU (KB-MB). Stores frequently accessed data to reduce
CPU waiting time.
3
Main Memory (RAM)
Moderate speed, larger capacity (GB). Primary working memory for running
applications.
4
Secondary Storage
Slow, large, persistent storage (HDD/SSD, TB). Retains data when
power is off.
The memory hierarchy balances speed and cost while providing fast access to frequently used data. Data moves between levels based on usage
patterns through processes like caching and swapping, optimizing overall system performance.
Types of Memory Allocation
Contiguous Allocation
Process occupies a single contiguous block of memory.
This approach includes fixed partitioning, where memory is
divided into predetermined blocks, and dynamic
partitioning, where memory is allocated based on process
needs.
Non-Contiguous Allocation
Process memory is spread across non-adjacent locations.
This includes techniques like paging and segmentation,
which allow more flexible memory utilization.
Memory allocation strategies aim to minimize fragmentation and optimize memory usage. Internal fragmentation occurs
when there is wasted space within allocated memory (common in fixed partitions), while external fragmentation refers to
wasted space between allocated blocks (typical in dynamic partitioning).
Fixed and Dynamic Partitioning
Fixed Partitioning
Memory divided into fixed-size partitions with each
partition holding one process. Simple to implement but
suffers from internal fragmentation and limits process
size.
Dynamic Partitioning
Memory allocated dynamically as processes arrive. Offers
flexibility with no size limits for processes but leads to
external fragmentation and requires compaction.
In fixed partitioning, a system with 4 partitions of 8 MB each would waste 2 MB when running a 6 MB process. With dynamic
partitioning, a 6 MB process would receive exactly 6 MB, but over time, gaps form between allocations as processes
terminate, leading to fragmentation challenges.
Read More