Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Worst Fit Algorithm in Operating System (OS)

Worst Fit algorithm in OS

Worst Fit Algorithm in Operating System

 

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.

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.

Worst Fit in OS

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: Stop.