First-fit, Best-fit, Worst fit

Different memory partitions of 150 KB, 820 KB, 360 KB and 350 KB (in the given order) are present.

1. Explain how best-fit algorithm can be used to place a process of 315 KB.
2. What are the advantages and disadvantages of using best fit over worst fit and first-fit    
    algorithms? 

Answer:

Q.1.

Best-Fit:
Search the entire partition and allocate a job in such a partition that internal fragmentation will be minimized.Choose the closest  space for each process.
 Now,
          The internal fragmentation is = (350-315) = 35 KB.
And,
          The external fragmentation is =(150+820+360) = 1330 KB.

Q.2

Advantage

Memory utilization is much better than first-fit and Worst-fit. The internal and external fragmentation are smaller then first-fit and worst-fit.

Disadvantage

It is slower and may even tend to fill up memory with tiny useless holes.


First-fit, Best-fit, Worst fit definitions, advantages and disadvantages

check this example to better understand

Comments

Popular Posts