Consider allocation of memory to a new process. Assume that none of the…
2020
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 statement is TRUE ?
- A.
The hole created by first fit is always larger than the hole created by next fit.
- B.
The hole created by worst fit is always larger than the hole created by first fit.
- C.
The hole created by best fit is never larger than the hole created by first fit.
- D.
The hole created by next fit is never larger than the hole created by best fit.
Attempted by 352 students.
Show answer & explanation
Correct answer: C
Key idea: best fit picks the smallest hole that can accommodate the process, so it minimizes the leftover space.
Let h_best be the size of the hole chosen by best fit and h_first be the size chosen by first fit.
Because best fit chooses the smallest sufficient hole, h_best <= h_first.
The leftover hole after allocation is (hole_size - process_size), so leftover_best = h_best - p <= h_first - p = leftover_first.
Therefore the hole created by best fit is never larger than the hole created by first fit.