linked allocation - TarisMajor/5143-OpSystems GitHub Wiki
Linked allocation is a file storage method where each file is a linked list of disk blocks, which do not need to be contiguous. Each block contains a pointer to the next block in the sequence, allowing for efficient use of disk space without the need for large contiguous allocations.
- Non-contiguous Blocks: Files are stored in non-contiguous blocks, meaning that each block can be located anywhere on the disk.
- Pointers: Each block contains a pointer to the next block, creating a linked list structure. This allows for dynamic allocation and easy expansion of files.
- Sequential Access: Linked allocation is particularly efficient for sequential access, as the blocks are linked in order.
- No External Fragmentation: Since blocks can be scattered anywhere on the disk, linked allocation eliminates external fragmentation.
- Dynamic File Size: Files can grow dynamically by simply adding new blocks and updating pointers, making it flexible for varying file sizes.
- Simple File Creation: Creating files is straightforward, as it involves linking free blocks without worrying about finding large contiguous spaces.
- Sequential Access Only: Random access is slow and inefficient because each block must be read in sequence to reach a specific position within the file.
- Pointer Overhead: Each block contains a pointer to the next block, reducing the effective data storage capacity. This overhead can be significant for small block sizes.
- Reliability Concerns: If a block's pointer is corrupted, it can lead to data loss or the inability to access parts of the file. Error detection and recovery mechanisms are essential.
- Sequential Data Storage: Ideal for storing sequential data such as log files, streaming data, and large binary files where sequential access is predominant.
- Dynamic File Systems: Suitable for file systems that need to handle frequent file growth and changes without significant fragmentation.
- Simple File Systems: Useful in simpler file systems where the primary requirement is to minimize fragmentation and manage disk space dynamically.