Memory Management Concepts
1. Multiprogramming with Fixed and Variable Partitions
Fixed Partition:
- Memory is divided into fixed-size blocks.
- Leads to internal fragmentation.
- Simple to implement but not flexible.
- Poor memory utilization.
Variable Partition:
- Memory is divided dynamically as per process size.
- Reduces internal fragmentation, may lead to external fragmentation.
- More flexible and efficient.
- Requires compaction for memory optimization.
2. Protection Schemes
1. Base and Limit Register: Uses a base and limit to ensure memory access is within bounds.
2. Segmentation: Divides memory into logical segments, each with protection.
3. Paging: Divides memory into pages/frames, supports protection bits.
4. Virtual Memory with Access Control Bits: Uses RWX bits, MMU for protection.
5. Hardware Traps: OS traps illegal memory access (e.g., segmentation fault).
3. Paging and Segmentation
Paging:
- Divides memory into fixed-size pages/frames.
- Eliminates external fragmentation.
Memory Management Concepts
- Uses page tables for address translation.
- Causes internal fragmentation.
Segmentation:
- Divides memory into variable-sized logical segments.
- External fragmentation may occur.
- Reflects program's logical structure.
- Uses segment tables for translation.
4. Paged Segmentation
- Combines paging and segmentation.
- Each segment is divided into pages.
- Logical address: Segment no + Page no + Offset.
- Uses segment table and page tables per segment.
- Reduces fragmentation, supports logical structuring.
Advantages:
- Logical organization, efficient memory use, protection.
Disadvantages:
- Complex management, high overhead, slower access.
5. Virtual Memory
- Provides illusion of large memory using RAM + disk.
- Uses paging, page tables, and MMU.
- Supports multitasking, isolation, protection.
Advantages:
- Efficient memory use, faster loading, larger program support.
Memory Management Concepts
Disadvantages:
- Slower due to disk access, thrashing, complexity.
6. Demand Paging
- Loads pages into memory only when needed.
- Minimizes memory use, improves efficiency.
Steps:
1. Page not in memory -> Page Fault.
2. OS loads page from disk -> Updates page table.
3. Execution resumes.
Advantages:
- Efficient memory, faster startup, virtual memory support.
Disadvantages:
- Page faults, thrashing, overhead, slower due to disk I/O.
Compared to Pre-paging:
- On-demand vs. predictive loading.