Memory Allocation Sandbox

CSC-264 · Semester IV · Operating Systems

Memory Allocation

First / Best / Worst fit on a fixed set of partitions.

Memory layout (100 KB pool)

J1
J2
free
J5
J1 12KJ4 4Kfree 4KJ2 10KJ3 9Kfree 9Kfree 6Kfree 14KJ5 20Kfree 2Kfree 8K

Used

55 KB

Rejected jobs

1

Allocation trace

J1 (12 KB)placed 012
J2 (10 KB)placed 2030
J3 (9 KB)placed 3039
J4 (4 KB)placed 1216
J5 (20 KB)placed 6888
J6 (17 KB)no partition fits
Compare the strategies: First fit is fastest, Best fit minimizes leftover fragments but leaves tiny holes, Worst fit keeps large holes available for future big jobs but wastes the most space on small ones.