Memory Allocation & Segmentation


Answer & solution
Answer: At time 19 under listed-order, nonpreemptive fixed-partition scheduling. (no official key was published)
Assume all jobs are available at time 0, listed order resolves admission priority, partitions are fixed and not split, runtimes are elapsed times while resident, and loading/switching costs are zero. Best fit places an admitted job in the smallest currently free partition that accommodates it. Call the listed jobs J1 through J8.
At time 0, J1 occupies 2 KB until t=4, J2 occupies 20 KB until t=10, J3 occupies 4 KB until t=2, and J4 occupies 8 KB until t=1. J5, J6 and J7 cannot yet fit. At t=1, J4 finishes and J5 enters the 8 KB partition for four units, finishing at t=5.
The critical resource is the 20 KB partition. J6 needs 10 KB, so it cannot use the 4,8 or 2 KB partitions. J7 needs the entire 20 KB partition. At t=10, J2 releases it. Listed-order priority admits J6 first for one unit, t=10 to 11. Then J7 runs for eight units, t=11 to 19. Thus the requested completion time is 10+1+8=19.
A compact critical-resource diagram is:
20 KB: | J2, 0–10 | J6, 10–11 | J7, 11–19 |
8 KB: | J4, 0–1 | J5, 1–5 |
J8 may enter a smaller partition earlier if the allocator bypasses blocked jobs, or later under strict head-of-line waiting; this does not change the listed-order use of the 20 KB partition. Best fit alone specifies a partition choice, not a scheduling discipline or arrival times. If arbitrary priority allowed J7 ahead of J6 at t=10, it would finish at 18. Therefore 19 is the conventional answer with the stated order assumptions, not a consequence of the phrase “best fit” alone.