After the first five allocations, memory is completely occupied:
$[P_1:4][P_2:2][P_3:2][P_4:3][P_5:5]$
After freeing $P_1$, $P_3$, and $P_5$:
$[\text{Free }4][P_2:2][\text{Free }2][P_4:3][\text{Free }5]$
So the initial free holes are:
$\boxed{4,\ 2,\ 5}$
First Fit
Request $1$ KB uses the first $4$ KB hole:
$4\rightarrow3$
Free holes: $3,\ 2,\ 5$
Request $3$ KB uses the first hole exactly: $2,\ 5$
Request $2$ KB uses the $2$ KB hole: $5$
Finally, the $5$ KB request fits exactly.
Therefore, First Fit satisfies all four requests.
So A is true.
Best Fit
Start with:
$4,\ 2,\ 5$
Request $1$ KB uses the smallest suitable hole, $2$ KB:
$4,\ 1,\ 5$
Request $3$ KB uses the $4$ KB hole:
$1,\ 1,\ 5$
Request $2$ KB uses the $5$ KB hole:
$1,\ 1,\ 3$
Now the final request is $5$ KB.
Total free memory is still
$1+1+3=5$ KB,
but the largest individual hole is only $3$ KB.
Hence the request fails due to external fragmentation.
So B is true.
Worst Fit
Start with:
$4,\ 2,\ 5$
Request $1$ KB uses the $5$ KB hole:
$4,\ 2,\ 4$
Request $3$ KB uses one of the $4$ KB holes:
$1,\ 2,\ 4$
Request $2$ KB uses the largest $4$ KB hole:
$1,\ 2,\ 2$
Now the final $5$ KB request cannot be allocated.
Again, total free memory is
$1+2+2=5$ KB,
but there is no contiguous $5$ KB hole.
So C is true.
D is false because immediately before the final request, the largest holes are:
- First Fit: $5$ KB
- Best Fit: $3$ KB
- Worst Fit: $2$ KB