Initial there is $1000k$ main memory available.
Then job $1$ arrive and occupied $200k$, then job $2$ arrive, occupy $350k$, after that job $3$ arrive and occupy $300k$ (assume continuous allocation ) now free memory is $1000-850(200+350+300)= 150k$ (till these jobs first fit and best fit are same)
Now, job $1$ is finished. So, that space is also free. So, here $200k$ slot and $150k$ slots are free.
Now, job $4$ arrives which is $120k$.
Case 1:
- First fit, so it will be in $200$ k slot (free slot ) and now free is $= 200-120=80k$,
- Now $150k$ arrive which will be in $150$ $k$ slot
- Then, $80k$ arrive which will occupy in $80k$ slot $(200-120)$ so, all jobs will be allocated successfully.
Case 2:
- Best fit : $120 k$ job will occupy best fit free space which is $150k$ so, now remaining $150-120=30k$,
- Then $150k$ job arrive it will be occupied in $200k$ slot, which is best fit for this job. So, free space $=200-150= 50$,
- Now, job $80k$ arrive, but there is no continuous $80k$ memory free. So, it will not be allocated successfully.
So, first fit is better.