Contiguous Allocation in File Systems
What is Contiguous Allocation?
Contiguous allocation is a method used to store files on a disk. In this method, a file is stored in
one continuous block of memory on the disk. This means all parts of the file are kept together
without being scattered in different locations.
Each file has:
• A starting block address (the first block where the file begins).
• The length of the file (how many blocks it occupies).
How Does It Work?
When a file is saved, the system looks for a large enough continuous (contiguous) space on the
disk. If a suitable space is found, the file is stored in that location.
For example:
If a file needs 3 blocks, and the disk has free space in blocks 2, 3, and 4, the system stores the
file there.
File Start Block Length (Blocks)
A 2 3
B 4 7
Advantages of Contiguous Allocation
1. Simple to Implement – It is easy for the operating system to manage because it only
needs to keep track of the starting block and file length.
2. Fast Access – Since all parts of the file are stored together, the system can read the file
quickly.
3. Good for Sequential Files – It works well for files that are read from start to end, like
videos or large documents.
Disadvantages of Contiguous Allocation
1. Difficult to Find Free Space – When a file is deleted, it leaves a gap. New files may not fit
into these gaps, making it hard to find space for new files.
2. External Fragmentation – Over time, free space gets divided into small pieces that are
too small for new files. This wastes storage space.
3. Not Used in Modern File Systems – Because of these problems, modern file systems use
different allocation methods like linked allocation or indexed allocation instead.
Conclusion
Contiguous allocation is a simple way to store files, but it has major problems, especially with
fragmentation and space management. That is why it is not commonly used in modern
operating systems.
4o