For both fixed and dynamic memory allocation schemes, the operating system must keep list of each memory location noting which are free and which are busy. Then as new jobs come into the system, the free partitions must be allocated.
These partitions may be allocated by 4 ways:
1. First-Fit Memory Allocation 2. Best-Fit Memory Allocation 3. Worst-Fit Memory Allocation 4. Next-Fit Memory Allocation
These are Contiguous memory allocation techniques.
Worst-Fit Memory Allocation :
In this allocation technique the process traverse the whole memory and always search for largest hole/partition, and then the process is placed in that hole/partition.It is a slow process because it has to traverse the entire memory to search largest bole.
Here is an example to understand Worst Fit-Allocation –
Here Process P1=30K is allocated with the Worst Fit-Allocation technique, so it traverse the entire memory and selects memory size 400K which is the largest and hence there is an internal fragmentation of 370K which is very large and so many other processes can also utilize this left over space.
Advantages of Worst-Fit Allocation :
Since this process chooses the largest hole/partition, therefore there will be large internal fragmentation. Now, this internal fragmentation will be quite big so that other small processes can also be placed in that left over partition.
Disadvantages of Worst-Fit Allocation :
It is a slow process because it traverse all the partitions in the memory and then selects the largest partition among all the partitions, which is a time consuming process.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- First-Fit Allocation in Operating Systems
- Buddy Memory Allocation Program | Set 1 (Allocation)
- Difference between Static allocation and Stack allocation
- Difference between Static Allocation and Heap Allocation
- Operating Systems | Input Output Systems | Question 5
- Resource Allocation Graph (RAG) in Operating System
- Allocation of frames in Operating System
- Non-Contiguous Allocation in Operating System
- Best-Fit Allocation in Operating System
- Operating Systems | Set 1
- Operating Systems | Set 2
- Operating Systems | Set 3
- Operating Systems | Set 4
- Operating Systems | Set 5
- Operating Systems | Set 6
- Operating Systems | Set 10
- Operating Systems | Set 7
- Operating Systems | Set 8
- Operating Systems | Set 9
- Operating Systems | Set 11
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : aman singh 34