Worst-Fit Allocation in Operating Systems

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.

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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

Article Tags :
Practice Tags :