About this simulator
The operating system must decide where in main memory each process goes. Contiguous allocation chooses a free hole by first fit, best fit or worst fit and can leave unusable gaps (external fragmentation). Paging avoids that by splitting memory into fixed-size frames and translating logical addresses through a page table. Both techniques are simulated here with your own numbers.
How it works
- First fit takes the first hole that is big enough; Best fit the smallest big-enough hole; Worst fit the largest hole.
- Holes left too small to use cause external fragmentation.
- In paging, a logical address ; the page table maps the page to a frame.
Formulas used
Worked example
Holes of 100, 500, 200, 300 and 600 KB receive processes of 212, 417, 112 and 426 KB. First fit places 212 in the 500 KB hole, 417 in 600 KB, 112 in the leftover 288 KB, but 426 KB fails. Best fit places all four. For paging with 100-byte pages, logical address 250 is page 2, offset 50; if page 2 is in frame 7 the physical address is 7 × 100 + 50 = 750.
Enter these numbers in the simulator above to see every step.
When to use it
- Comparing placement strategies on the same request sequence.
- Converting logical addresses to physical addresses for exam problems.
- Seeing external fragmentation: plenty of free memory in total but no hole big enough.
Frequently asked questions
Which is better: first fit, best fit or worst fit?
First fit is usually fastest; best fit leaves the smallest leftover holes but can create many tiny ones; worst fit leaves larger leftovers. Which places the most processes depends on the request sequence — try all three above.
How do you convert a logical address to a physical address in paging?
and . Look up the frame in the page table; .
What is external fragmentation?
Free memory that is split into pieces too small to satisfy a request even though the total free space is large enough.