Indexed File Allocation solves the fragmentation and file growth problems of sequential allocation by using a dedicated index block for each file. This index block contains pointers to all the disk blocks allocated to that file.
The file system maintains an index table where each entry corresponds to a file and points to its index block. When accessing a file, the system first reads the index block to locate all the data blocks. This allows for non-contiguous storage while maintaining efficient direct access.
The main advantage is elimination of external fragmentation and support for dynamic file growth. However, it requires additional space for index blocks and may have performance overhead for very large files that need multi-level indexing.
Advantages
- No external fragmentation - efficient disk space utilization
- Supports direct access to any file block
- Files can grow dynamically without relocation
- Better for frequently modified files compared to sequential
Disadvantages
- Overhead of maintaining index blocks
- For large files, multi-level indexing may be needed
- Additional I/O operation to access index block first
- Wasted space if index block isn't fully utilized