File allocation algorithms are used in operating systems to determine how files are stored on disk drives. These algorithms determine the most efficient way to allocate space for files, considering factors such as disk fragmentation, file size, and file access patterns.

Contiguous file allocation


Contiguous file allocation allows for fast sequential access to files. It is simple to implement, as it only requires storing the starting block address and length of each file. However, it can suffer from external fragmentation and also poses challenges when files need to grow.


Linked file allocation


Linked file allocation eliminates external fragmentation by storing files as linked lists of blocks. However, it increases metadata overhead due to pointers in each block and slows random access because the linked list must be traversed from the beginning for each access.


Indexed file allocation


Indexed file allocation supports direct access to file blocks, providing fast access and overcoming external fragmentation. However, it incurs higher pointer overhead compared to linked allocation, especially inefficient for small files since an entire index block is used for pointers.