Contiguous Allocation
Contiguous Allocation means all the files are allocated in a linear ordering on the disk with a fixed length.
Advantages:
- Both the Sequential and Direct Accesses are supported by contiguous allocation.
- Accessing a file that has been allocated contiguously is easy.
- The number of disk seeks required for accessing contiguously allocated files is minimal.
Disadvantages:
- Dynamic storage-allocation problem which involves how to satisfy a request of size n from a list of free holes. How to select a free hole form the set of available holes.
- External fragmentation. As files are allocated and deleted, the free disk space is broken into chunks. When the largest contiguous chunk is insufficient for a request; storage is fragmented into a number of holes, no one if which is large enough to store the data.
Linked Allocation
Each file is a linked list of disk blocks; the disk blocks may be scattered anywhere on the disk.
Advantages:
- This is very flexible in terms of file size. File size can be increased easily since the system does not have to look for a contiguous chunk of memory.
- This method does not suffer from external fragmentation. This makes it relatively better in terms of memory utilization.
Disadvantages:
- Because the file blocks are distributed randomly on the disk, a large number of seeks are needed to access every block individually. This makes linked allocation slower.
- It does not support random or direct access. We can not directly access the blocks of a file. A block k of a file can be accessed by traversing k blocks sequentially (sequential access ) from the starting block of the file via block pointers.
- Pointers required in the linked allocation incur some extra overhead.
Indexed Allocation
Advantages:
- This supports direct access to the blocks occupied by the file and therefore provides fast access to the file blocks.
- It overcomes the problem of external fragmentation.
Disadvantages:
- The pointer overhead for indexed allocation is greater than linked allocation.
- For very small files, say files that expand only 2-3 blocks, the indexed allocation would keep one entire block (index block) for the pointers which is inefficient in terms of memory utilization. However, in linked allocation we lose the space of only 1 pointer per block.