# GATE - 2020 | Consider allocation of memory to a new process. Assume that none of the existing

## Question:

Consider allocation of memory to a new process. Assume that none of the existing holes in the memory will exactly fit the process’s memory requirement. Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes. Which one of the following statements is TRUE?

 A The hole created by worst fit is always larger than the hole created by first fit. B The hole created by best fit is never larger than the hole created by first fit. C The hole created by first fit is always larger than the hole created by next fit. D The hole created by next fit is never larger than the hole created by best fit.

## Solution:

The size of hole created using best fit is never greater than size created by first fit. The best fit chooses the smallest available partition to fit the size of the process. Whereas, first fit and next fit doesn’t consider the size of the holes available.

(A) May not be correct if size of partition in first fit smaller than size of partition in next fit.

(B) May not be correct if both worst fit and first fit in same partition.

(C) Always correct, because best fit always has minimum hole.

(D) Absolutely false.

## Concept:

Best fit allocation:

The best fit allocation strategy chooses the smallest available memory partition that can satisfy the memory requirement.  It creates the smallest hole.

First fit allocation:

The first fit chooses the first available memory partition that can satisfy the requirement.

Worst Fit allocation:

The worst fit allocation strategy chooses the largest available memory partition that can satisfy the memory requirement. It creates the largest hole.

Next fit allocation:

It works same as First Fit, the only difference it maintain a pointer to all last allocated memory space to the process and begins it search from there if new request is arrived, unlike first fit which start will initial memory space.

Thank You