#AllocationMethods #FileAllocationMethods #operatingsystemlectures
Allocation Methods

There are various methods which can be used to allocate disk space to the files. Selection of an appropriate allocation method will significantly affect the performance and efficiency of the system. Allocation method provides a way in which the disk will be utilized and the files will be accessed.

There are following methods which can be used for allocation.

Contiguous Allocation.
Extents
Linked Allocation
Clustering
FAT
Indexed Allocation
Linked Indexed Allocation
Multilevel Indexed Allocation
Inode

We will discuss three of the most used methods in detail.
Contiguous Allocation

If the blocks are allocated to the file in such a way that all the logical blocks of the file get the contiguous physical block in the hard disk then such allocation scheme is known as contiguous allocation.

In the image shown below, there are three files in the directory. The starting block and the length of each file are mentioned in the table. We can check in the table that the contiguous blocks are assigned to each file as per its need.
Advantages

It is simple to implement.
We will get Excellent read performance.
Supports Random Access into files.

Disadvantages

The disk will become fragmented.
It may be difficult to have a file grow.
Linked List Allocation

Linked List allocation solves all problems of contiguous allocation. In linked list allocation, each file is considered as the linked list of disk blocks. However, the disks blocks allocated to a particular file need not to be contiguous on the disk. Each disk block allocated to a file contains a pointer which points to the next disk block allocated to the same file.
Advantages

There is no external fragmentation with linked allocation.
Any free block can be utilized in order to satisfy the file block requests.
File can continue to grow as long as the free blocks are available.
Directory entry will only contain the starting block address.

Disadvantages

Random Access is not provided.
Pointers require some space in the disk blocks.
Any of the pointers in the linked list must not be broken otherwise the file will get corrupted.
Need to traverse each block.

Indexed Allocation
Limitation of FAT

Limitation in the existing technology causes the evolution of a new technology. Till now, we have seen various allocation methods; each of them was carrying several advantages and disadvantages.

File allocation table tries to solve as many problems as possible but leads to a drawback. The more the number of blocks, the more will be the size of FAT.

Therefore, we need to allocate more space to a file allocation table. Since, file allocation table needs to be cached therefore it is impossible to have as many space in cache. Here we need a new technology which can solve such problems.