Worst Fit Algorithm in Operating System (OS)


The processes need empty memory slots during processing time. This memory is allocated to the processes by the operating system which decides depending on the free memory and the demanded memory by the process in execution. The three most common memory allocation schemes are first fit, best fit, and worst fit.

In the case of the worst fit memory allocation scheme, the operating system searches for free memory blocks demanded by the operating system. An empty block is assigned to the processes as soon as the CPU identifies it. The scheme is also said as the worst fit memory management scheme as sometimes a process is allocated a memory block which is much larger to the actual demand resulting in a huge amount of wasted memory.

The operating system conducts this memory allocation using an algorithm.

Algorithm for Worst Fit Memory Management Scheme

Step 1:

Input memory block with a size.

Step 2:

Input process with size.

Step 3:

Initialize by selecting each process to find the maximum block size that can be assigned to the current process.

Step 4:

If the condition does not fulfill, they leave the process.

Step 5:

If the condition is not fulfilled, then leave the process and check for the next process.

Step 6:


Please Login/Signup to comment