Memory Management in OS
Memory Management in OS is a fundamental concept that controls how memory is allocated, used, and optimized for efficient execution of programs. It ensures maximum utilization of RAM and CPU while supporting multitasking and system stability.
What is Memory Management in OS?
Memory Management in OS is the process of managing main memory (RAM) by allocating and deallocating memory to processes efficiently. The list of key concepts related to memory management is given below.
-
Allocation: Assigning memory to processes
-
Deallocation: Releasing memory after execution
-
Tracking: Keeping record of processes in memory
-
Optimization: Improving system performance
Degree of Multiprogramming in OS
Degree of Multiprogramming refers to the number of processes that can be loaded into main memory at the same time to improve CPU utilization. The list of concepts related to degree of multiprogramming is given below.
1. Definition of Degree of Multiprogramming
Degree of multiprogramming describes how many processes a system can handle efficiently at a time.
-
More Processes in RAM: Higher degree
-
Better CPU Utilization: Less idle time
-
Efficient System Performance: Improved throughput
2. Goal of Degree of Multiprogramming
The main goal is to maximize CPU utilization by keeping multiple processes ready for execution.
-
Maximum CPU Usage: Avoid idle CPU
-
Better Resource Utilization: Efficient system usage
-
High Throughput: More tasks completed
3. How to Improve Degree of Multiprogramming
Increasing the number of processes in memory improves system performance.
-
Increase RAM Size: More processes can fit
-
Efficient Memory Allocation: Better utilization
-
Use Virtual Memory: Supports more processes
4. CPU Utilization Formula
CPU utilization depends on the probability of processes waiting for I/O operations.
CPU\ Utilization = 1 – K^n
Where:
-
K: Fraction of time a process spends waiting for I/O
-
n: Number of processes in memory
5. Example of CPU Utilization
Assume I/O wait time (K) = 0.7, then CPU utilization increases as processes increase.
| Number of Processes (n) | CPU Utilization |
|---|---|
| 1 | 1 − (0.7)¹ = 30% |
| 2 | 1 − (0.7)² = 51% |
| 5 | 1 − (0.7)⁵ ≈ 83% |
| 10 | 1 − (0.7)¹⁰ ≈ 96% |
-
Conclusion: Increasing processes improves CPU utilization
-
Key Insight: More processes → Less idle CPU
Memory Management Techniques
Memory management techniques define how memory is allocated and accessed efficiently. The list of major memory management techniques is given below.

1. Contiguous Memory Allocation
Contiguous memory allocation assigns a single continuous block of memory to each process.
1.1 Fixed Memory Partitioning
Fixed partitioning divides memory into equal-sized blocks before execution.
-
Predefined Partitions: Fixed size blocks
-
Simple Implementation: Easy to manage
-
Disadvantage: Internal fragmentation
1.2 Variable Memory Partitioning
Variable partitioning allocates memory dynamically based on process size.
-
Flexible Allocation: Fits process size
-
Better Utilization: Less waste
-
Disadvantage: External fragmentation
2. Non-Contiguous Memory Allocation
Non-contiguous memory allocation allows processes to be stored in different locations in memory. The list of non-contiguous techniques is given below.
2.1 Paging
Paging divides memory into fixed-size pages and frames for efficient allocation.
-
No External Fragmentation
-
Easy Allocation
-
Uses Page Table
2.2 Multilevel Paging
Multilevel paging reduces the size of page tables by dividing them into multiple levels.
-
Hierarchical Structure
-
Efficient Memory Usage
-
Reduced Overhead
2.3 Inverted Paging
Inverted paging uses a single global page table instead of multiple tables for each process.
-
One Entry Per Frame
-
Reduces Memory Overhead
-
Uses Hashing for Search
2.4 Segmentation
Segmentation divides memory into logical segments such as code, data, and stack.
-
Logical Division
-
Supports Modular Programming
-
External Fragmentation Issue
2.5 Segmented Paging
Segmented paging combines both segmentation and paging techniques.
-
Two-Level Mapping
-
Reduces Fragmentation
-
More Complex System
Fragmentation in Memory Management
Fragmentation occurs when memory is not used efficiently, causing wastage. The list of fragmentation types is given below.
1. Internal Fragmentation
Internal fragmentation happens when allocated memory is larger than required.
-
Occurs in Fixed Allocation
-
Wastes Space Inside Block
2. External Fragmentation
External fragmentation occurs when free memory is scattered in small blocks.
-
Occurs in Variable Allocation
-
Prevents Large Allocation
Swapping in Memory Management
Swapping is a process of moving processes between main memory and secondary memory.
-
Temporarily Moves Processes: RAM to disk
-
Supports Multitasking: More processes run
-
Slower Performance: Due to disk access
Comparison Table: Contiguous vs Non-Contiguous Allocation
| Feature | Contiguous Allocation | Non-Contiguous Allocation |
|---|---|---|
| Memory Location | Continuous | Scattered |
| Flexibility | Low | High |
| Fragmentation | High | Reduced |
| Complexity | Simple | Complex |
| Efficiency | Lower | Higher |
Advantages of Memory Management
Memory management improves system performance and resource utilization. The list of advantages is given below.
-
Efficient Memory Utilization
-
Supports Multitasking
-
Improves CPU Performance
-
Better Resource Allocation
Limitations of Memory Management
Memory management also has some challenges that affect system performance. The list of limitations is given below.
-
Complex Implementation
-
Overhead in Management
-
Fragmentation Issues
-
Performance Delay in Virtual Memory
Conclusion
Memory Management in Operating System is essential for efficient use of memory and maximizing CPU utilization. By increasing the degree of multiprogramming and using advanced techniques like paging and segmentation, systems can achieve high performance, better resource management, and improved multitasking.