|
![]()
Contiguous Allocation Method
Summary:
In this method data in a file is stored in a contiguous section of the disk (that is, the file occupies a linear sequence of disk blocks). The directory entry for each file contains the file name, start block number and the file size.
Simulation:
[Help]
Advantages:
- Simple to implement
- Allows linear and sequential access with the same ease
Disadvantages:
- Does not allow simple expansion of files
- Risk of external fragmentation
- Solving the fragmentation problem requires compaction, a time consuming process
- The kernel must allocate and reserve contiguous space when the file is first created
![]()
Linked Allocation Method
Summary:
Here the data blocks of a file can be scattered anywhere on the disk. The directory entry of a file contains the start block number and the file name. Each data block uses 4 bytes of its space for a pointer to the next block of the file. This continues until the last block which has a special end-of-file (EOF) value.
Simulation:
[Help]
Advantages:
- No external fragmentation. Any free block can be used to satisfy the request
- A file can expand. No need to declare the file size when the file is first created
- No need to compact disk space
Disadvantages:
- Direct-access is very inefficient
- The pointers take up some space
- Scattering the pointers all over the disk poses a reliability problem
![]()
Indexed Allocation Method
Summary:
In this allocation method an index block is allocated for each file that is created. The index block of a file contains all the pointers that point to the data blocks of that file. The directory entry contains the index block number and the file name.
Simulation:
[Help]
Advantages:
- Grouping all the pointers into one location solves the problem of reliability.
- Direct-access is efficient. The 'i'th entry in the index block points to the 'i'th block of the file.
Disadvantages:
- The pointers may waste a lot of space since an entire disk block must be allocated to hold them even if few pointers are actually used.
References
- Brookshear, J. G. (1997), Computer Science: An Overview, Fifth Edition, Addison-Wesley, Reading, MA.
- Nutt, G. (1997), Operating Systems: A Modern Perspective, First Edition, Addison-Wesley, Reading, MA.
- Tanenbaum, A and Woodhull, A. (1997) Operating Systems: Design and Implementation, Second Edition, Prentice Hall, Upper Saddle River, NJ.
- Moosani, H. (1998), "Graphical Simulation of Disk Block Allocation Methods," http://unity.njit.edu/students/fall98/haritha/frame_page.htm.