Best Fit Allocation

First Fit - Simulation

Best Fit

In the case of the best fit memory allocation scheme, the operating system searches for the empty memory block. When the operating system finds the memory block with minimum wastage of memory, it is allocated to the process.


How does it work?

In Best fit memory allocation scheme, the operating system searches that can –

  • Accommodate the process
  • Also, leaves the minimum memory wastage

Example:

If you see the image right you will see that the process size is 40.


While blocks 1, 2 and 4 can accommodate the process. Block 2 is chosen as it leaves the lowest memory wastage

Advantages of Best fit Allocation
  1. Efficient Memory Usage: It tries to reduce the wastage of space because it allocated the smallest appropriate holes for requesting process.

Disadvantages of Best fit Allocation
  1. It requires O(n) time to search the entire list and find the smallest one.
  2. As if it chooses the smallest possible space, so the very small size of hole is free and not fit farther for any process.
Example: In the above allocation a process of size 40 allocated to block 2 creating an extra space of 10 (50-40), in which no other process can be allocated.

Simulations

Card image cap
MVT-Best fit Simulation

Try out best fit allocation in variable task with visualising the process allocation in main memory

Go to simulator
Card image cap
MFT-Best fit Simulation

Try out best fit allocation in fixed task with visualising the process allocation in main memory

Go to simulator