Operating Systems Memory Management and Bash Scripting
Classified in Computers
Written on in
English with a size of 4.74 KB
Memory Allocation Strategies
🔹 First Fit
👉 Take the first block that fits.
Example:
Blocks: 120, 450, 300, 700, 200
Processes: 250, 100, 500, 180
Step by step:
- 250 → goes into 450 → left: 200
- 100 → goes into 120 → left: 20
- 500 → goes into 700 → left: 200
- 180 → goes into 300 → left: 120
Final memory:20, 200, 120, 200, 200
🔹 Best Fit
👉 Use the smallest block that fits.
Same example:
- 250 → 300 → left 50
- 100 → 120 → left 20
- 500 → 700 → left 200
- 180 → 200 → left 20
Final:20, 450, 50, 200, 20
👉 Note: Causes more fragmentation (many small pieces).
🔹 Worst Fit
👉 Use the largest block.
Same example:
- 250 → 700 → left 450
- 100 → 450 → left 350
- 500 → ❌ no block large enough
- 180 → 350 → left 170
🔹 Next Fit
👉... Continue reading "Operating Systems Memory Management and Bash Scripting" »