/    /  OS – File Allocation methods 

File Allocation methods 

 

There are three main allocation methods:

  1. Linked Allocation
  2. Indexed Allocation
  3. Contiguous Allocation

 

Linked Allocation

In linked allocation, each file is linked to disk blocks that may or may not be contiguous. 

The file size for linked allocation is very flexible, as the system does not need to look for contiguous memory. It is also free of external fragmentation.

The only disadvantages are that it is a slower method as the file blocks are randomly scattered in the disk, and it requires time to access every block individually. It also does not support direct access, and the pointers required in this scheme incur extra overheads.

 

Indexed Allocation

Indexed allocation contains the pointers to all blocks occupied by a file. Every file has its index block. 

This scheme supports direct access to the blocks and also overcomes the problems of external fragmentation. Hence, it is a faster scheme.

Some disadvantages are that:

  • The pointer overhead is larger compared to linked allocation. 
  • Even for small files, it will keep one entire block for the pointers. This makes memory utilization inefficient.

 

Contiguous Allocation

In contiguous allocation, every file occupies a contiguous set of blocks on the disk. 

The directory entry for files with contiguous allocation contains:

  1. Address of the starting block.
  2. Length of allocated portion.

 

This scheme supports direct access and sequential access, and this is the fastest method. 

However, there is internal and external fragmentation and no flexibility regarding the file size. 

 

Reference

File Allocation methods