Consider a multi-partition memory mgmt system that may use any of the
FF, BF, or WF allocation schemes. Suppose that we added a "magic" sorting
routine that could sort the free space list by size, either large to small
or small to large, with almost no effort(a neat trick). Would you sort the
list large blocks to small or the other way around? Explain. (Hint: what is
the impact on the three "fit" methods?)
First Fit : Allocate first large enough block , which can accommodate the process. It includes less searching.
Best Fit : Find a smallest block that can accommodate process and assign it to process. Have to go through whole list of free blocks.
Worst Fit : Find a largest block in memory that can accommodate process and assign process to it. In this also, whole list has to be traversed.
if we sort free block list into small to large manner:
1) for worst fit, whole list has to be traversed to reach largest block.
2) for best fit, in worst case whole list might have to traversed. For best fit and worst fit both algorithm, whole list has to be traversed in worst case.
If free block list is sorted in large to small manner:
1) for worst fit, size of first block will decide if the process can be accommodated in memory or not which takes constant time.
2) In case of Best fit, in worst case, whole list might have to be traversed to find block.
Hence sorting list in large to small is better than the other way around.
Consider a multi-partition memory mgmt system that may use any of the FF, BF, or WF...