Part 01- Operating System Lecture for Gate Computer Science- Memory management and it’s application.
Part 01- Operating System Lecture for Gate Computer Science- Memory management and it’s application.
Contents
- 1 Operating System Lecture for GATE Computer Science
- 2 1. Introduction to Memory Management
- 3 Key Functions of Memory Management:
- 4 2. Types of Memory in an OS
- 5 3. Memory Allocation Techniques
- 6 A. Contiguous Memory Allocation
- 7 B. Non-Contiguous Memory Allocation
- 8 4. Virtual Memory & Its Applications
- 9 What is Virtual Memory?
- 10 5. Applications of Memory Management
- 11 Conclusion
- 12 Part 01- Operating System Lecture for Gate Computer Science- Memory management and it’s application.
- 13 UNIT NO: – 4 MEMORY MANAGEMENT
- 14 OPERATING SYSTEM Lecture Notes On
- 15 OPERATING SYSTEMS – MIS
Operating System Lecture for GATE Computer Science
Part 01: Memory Management & Its Applications
1. Introduction to Memory Management
Memory management is a crucial function of an operating system (OS) that handles the allocation and deallocation of memory for processes. It ensures efficient utilization of memory while preventing conflicts between different programs.
Key Functions of Memory Management:
- Process Isolation: Prevents one process from interfering with another.
- Allocation & Deallocation: Dynamically assigns memory as needed.
- Multitasking Support: Enables multiple processes to run concurrently.
- Memory Protection: Prevents unauthorized access to memory regions.
- Efficient Utilization: Maximizes memory usage while minimizing fragmentation.
2. Types of Memory in an OS
- Primary Memory (RAM): Volatile memory used for executing processes.
- Secondary Memory (Hard Disk, SSD): Non-volatile storage for programs and files.
- Cache Memory: Faster memory that stores frequently accessed data.
- Virtual Memory: Simulated memory that extends RAM using disk storage.
3. Memory Allocation Techniques
A. Contiguous Memory Allocation
-
Single Partition Allocation: Entire memory is given to a single process.
-
Multiple Partition Allocation: Memory is divided into fixed or variable-sized partitions.
Fixed Partitioning:
- Divides memory into fixed-sized blocks.
- Causes internal fragmentation if a process is smaller than a block.
Variable Partitioning:
- Allocates exactly the required space.
- Leads to external fragmentation over time.
B. Non-Contiguous Memory Allocation
Allows a process to be stored in non-contiguous memory locations, reducing fragmentation.
Paging:
- Divides memory into fixed-sized pages.
- Reduces external fragmentation but may cause internal fragmentation.
- Uses a Page Table to map logical to physical addresses.
Segmentation:
- Divides memory based on logical divisions (code, data, stack).
- Eliminates internal fragmentation but may suffer from external fragmentation.
Paging + Segmentation (Hybrid Model):
- Combines the benefits of both techniques.
- Used in modern OS like Linux & Windows.
4. Virtual Memory & Its Applications
What is Virtual Memory?
Virtual memory allows a computer to run programs larger than the available physical RAM by using swap space on the hard disk.
Working of Virtual Memory:
- Divides processes into pages.
- Stores some pages in RAM and others in disk storage.
- Uses Page Replacement Algorithms when RAM is full.
Page Replacement Algorithms:
- FIFO (First-In-First-Out) – Oldest page is replaced.
- LRU (Least Recently Used) – Least recently accessed page is removed.
- Optimal Page Replacement – Removes the page that will not be used for the longest time (ideal but difficult to implement).
Advantages of Virtual Memory:
Allows execution of large programs.
Provides memory isolation for processes.
Enables multitasking without requiring large RAM.
5. Applications of Memory Management
Operating Systems (Windows, Linux, MacOS): Use paging & segmentation for efficient memory handling.
Multitasking Environments: Run multiple applications simultaneously without crashes.
Cloud Computing & Virtualization: Allocate virtual memory for multiple users dynamically.
Embedded Systems: Optimizes memory usage in resource-constrained devices (IoT, mobile OS).
Conclusion
Memory management is essential for ensuring efficient and safe execution of processes in an OS. Techniques like paging, segmentation, and virtual memory help optimize resource utilization and improve system performance.
Would you like a detailed discussion on Paging, Segmentation, or Page Replacement Algorithms?