Trace first fit and best fit
Memory Allocation & Segmentation


Answer & solution
Answer: First fit admits all jobs; best fit cannot admit J6. (no official key was published)
Use half-open address intervals in K so that [0,200) has size 200. Both algorithms initially allocate J1=[0,200), J2=[200,550), J3=[550,850), leaving [850,1000) free. When J1 finishes, the holes are [0,200) and [850,1000).
First fit: J4 takes [0,120), leaving holes [120,200) of size 80 and [850,1000) of size 150. J5 cannot fit in 80, so it occupies [850,1000). J6 then exactly fills [120,200). Final low-to-high layout is J4:120 | J6:80 | J2:350 | J3:300 | J5:150.
Best fit: J4 takes the smaller adequate hole [850,1000), occupying [850,970) and leaving 30K. J5 takes [0,150), leaving [150,200) of size 50. J6 needs 80K but neither the 50K nor 30K hole suffices. Final layout is J5:150 | free:50 | J2:350 | J3:300 | J4:120 | free:30, with J6 waiting.
The total free space is 80K, equal to J6’s request, but it is split into nonadjacent holes. This is external fragmentation, not a shortage of aggregate space.



