Memory Management
Memory Management
1. Relocation:
o Processes need to move dynamically in memory during execution (swapping in
and out).
o This requires translation of logical memory references into physical addresses to
reflect current memory locations.
o Example: A process's memory image is not fixed and might occupy different
areas during execution.
2. Protection:
o Each process's memory space must be isolated to prevent unwanted interference
(accidental or intentional).
o Protection mechanisms must work at runtime to ensure processes cannot access
unauthorized memory locations.
o Hardware plays a vital role in enforcing protection since the OS cannot predict
memory references in advance.
3. Sharing:
o Memory management must allow controlled sharing of memory among processes
working together.
o Protection and relocation mechanisms often support sharing capabilities.
4. Logical Organization:
o Programs are organized into modules (some modifiable, others not) rather than
linear address spaces.
o Logical organization facilitates modular programming and enhances usability.
5. Physical Organization:
o Memory consists of fast, volatile main memory and slower, non-volatile
secondary memory.
o Efficient transfer of data between these two memory types is crucial for system
performance.
3. Memory Management Techniques
1. Fixed Partitioning:
2. Dynamic Partitioning:
3. Paging:
Divides memory and processes into fixed-sized units (pages and frames).
Eliminates both internal and external fragmentation by assigning non-contiguous memory
chunks to processes.
Addresses are managed using page tables.
4. Segmentation:
Divides programs into logical segments (e.g., functions, data structures) that align with
their logical structure.
Enhances program modularity but can result in external fragmentation.
5. Bitmaps:
Tracks memory allocation with a binary map indicating free (0) or occupied (1) units.
Challenges:
o Searching for free memory blocks in a bitmap can be slow, making it less
practical for large systems.
6. Linked Lists:
4. Key Challenges