Introduction
Contiguous Allocation क्या है?
जब किसी process को memory के एक ही continuous (लगातार) block में space दिया जाता है, उसे Contiguous Allocation कहते हैं।
Example:
| OS | P1 | P2 | P3 |
हर process को एक पूरा block मिला हुआ है
Types of Contiguous Allocation
1. Fixed Partitioning
- Memory को पहले से fixed blocks में divide कर देते हैं
- हर process को एक block मिलता है
Problem:
- Internal Fragmentation (memory waste)
2. Dynamic Partitioning
- Process के size के हिसाब से memory allocate होती है
Advantage:
- Memory waste कम
Problem:
- External Fragmentation
Fragmentation
Internal Fragmentation
- Block बड़ा है, process छोटा
- Extra space waste हो जाता है
External Fragmentation
- Free memory छोटे-छोटे टुकड़ों में बंट जाती है
- बड़ा process fit नहीं होता
Allocation Techniques
- First Fit
- Best Fit
- Worst Fit
ये methods decide करते हैं कि memory कहाँ allocate होगी
Non-Contiguous Allocation
Non-Contiguous Allocation क्या है?
जब process को memory के अलग-अलग हिस्सों में रखा जाता है (continuous नहीं), उसे Non-Contiguous Allocation कहते हैं।
Example:
| OS | P1 | P2 | P1 | P3 | P1 |
यहाँ P1 अलग-अलग जगहों पर है
Types of Non-Contiguous Allocation
1. Paging
- Memory को fixed size blocks में divide करते हैं
- Page (process)
- Frame (memory)
- Page Table mapping करता है
Advantage:
- External fragmentation खत्म
2. Segmentation
- Program को logical parts में divide करते हैं
- Code
- Data
- Stack
Advantage:
- Easy to understand
Problem:
- External Fragmentation
Comparison (Exam Point of View)
| Feature | Contiguous | Non-Contiguous |
|---|---|---|
| Allocation | एक block | कई जगह |
| Complexity | Simple | Complex |
| Fragmentation | High | कम |
| Efficiency | कम | ज्यादा |
| Example | Fixed/Dynamic Partition | Paging, Segmentation |
Short Conclusion
Contiguous Allocation में process को एक continuous memory block दिया जाता है। यह method simple होता है लेकिन इसमें fragmentation ज्यादा होती है।
Non-Contiguous Allocation में process को अलग-अलग memory locations पर रखा जाता है। यह method थोड़ा complex होता है लेकिन memory utilization बेहतर होता है।