The file allocation methods define how the files are stored in the disk blocks.
The main idea behind these methods is to provide:
There are 3 file allocation methods commonly used in Operating Systems to schedule files in the secondary disk.
All the three methods have their own advantages and disadvantages as discussed below:
Files are stored in consecutive blocks on the disk. Each file occupies a contiguous set of blocks.
Each file block contains a pointer to the next block. Files can be stored in any available blocks.
Uses an index block containing pointers to all blocks of the file. Provides efficient direct access.
| Feature | Contiguous | Linked | Indexed |
|---|---|---|---|
| Random Access | Excellent | Poor | Good |
| Space Efficiency | Poor | Good | Fair |
| Implementation | Simple | Complex | Moderate |