Wednesday 21 January 2015

First Fit, Best Fit and Worst Fit Memory Allocation

Best fit Allocation: It is the Contiguous allocation technique in which file is saved on the blocks whose size is same to file size or little more than file size. E.g. if we want to save a 200 Kb file and one block of 250KB is available then it will be saved to this available block.

The advantage of using this technique is best disk utilization but has the disadvantage that it is slow. Every time we want to save a file, we have to find a space whose size is either similar to file size or is slightly more.

Another Problem Associated with this technique is that if we want to extend the file contents than it can’t be implemented.



Worst Fit Allocation: This is the contiguous allocation Technique in which any available space is allocated to file which is too much large for that file. E.g. if we want to save a file of 100KB, it will be allocated any block whose size is more than 100KB. It results in wastage of disk space.

First Fit Allocation: In this technique file is allocated first empty memory block whose size is either equal to file size or is greater than file size. If the first block element is either of same size or slightly large size than it is best but If block is too large than it will result in memory wastage.

Figure below illustrates all three allocation techniques.

No comments:

Post a Comment