File Allcation Strategies
File Allcation Strategies
Doce
Section: BIT CT 4EG2
1 Contiguous Allocation:
2 Linked Allocation:
Each file is stored in a linked list of blocks, where each block contains a pointer to the
next block of the file.
Advantages:
o No external fragmentation, as files can be scattered across the disk.
o Easy to expand files by adding more blocks.
Disadvantages:
o Slower access time, as each block must be accessed sequentially, following
pointers.
o Requires extra space for storing pointers in each block.
3 Indexed Allocation:
In indexed allocation, a special index block is used to store pointers to the actual data
blocks of a file.
Advantages:
o Eliminates external fragmentation and allows random access to file data, as the
index block provides direct pointers to data blocks.
o Efficient use of space, as data blocks are not required to be contiguous.
Disadvantages:
o Extra overhead in managing index blocks.
o If files are very large, additional levels of indexing may be required, leading to
complexity.
4 Multi-level Indexed Allocation:
This is an extension of indexed allocation, where multiple levels of index blocks are used
to handle large files. The index block itself points to other index blocks, which point to
the actual data blocks.
Advantages:
o Allows efficient management of very large files.
Disadvantages:
o More complex to implement and manage.
o Increases overhead in terms of both space and access time due to multiple levels
of indirection.
5 Hybrid Allocation:
Some file systems use a combination of the above strategies to balance the benefits and
limitations of each.
For example, a file system might use contiguous allocation for small files and indexed
allocation for larger ones.
The File Allocation Table (FAT) is an older file system that uses a linked list method, but
with a more structured approach. The FAT is essentially a table that keeps track of which
blocks are allocated and which are free, as well as the chain of blocks for a file.
Advantages:
o Simple and widely supported across different operating systems.
o Efficient for small files and external storage devices like USB drives.
Disadvantages:
o Doesn't scale well for large files or volumes due to overhead and slow access
times for large amounts of data.
o Prone to fragmentation and inefficient use of space as file sizes grow.
7 B-tree Allocation:
In this strategy, a balanced tree (such as a B-tree or B+ tree) is used to organize the file
allocation blocks. The tree structure allows for efficient searching, insertion, and
deletion of blocks, and it’s particularly useful for large file systems.
Advantages:
o Efficient for managing a large number of files, as tree-based structures provide
fast search and access times.
o Can handle dynamic file systems with growing or shrinking files efficiently.
Disadvantages:
o More complex to implement than simpler allocation strategies like contiguous or
linked allocation.
o Requires additional resources for managing the tree structure.
In log-structured file systems, all changes to the file system (such as file modifications or
creation of new files) are written sequentially in a log-like structure. Instead of
overwriting data in place, the system writes new data and metadata to new locations.
Advantages:
o Write performance can be improved because data is written sequentially.
o Helps with disk wear leveling (important for SSDs) by spreading write operations.
Disadvantages:
o Requires garbage collection to reclaim old or unused blocks.
o Reading data may involve traversing the log, which can reduce read performance
if not optimized.
9 Extent-based Allocation: