Table of contents Introduction Allocation Methods Free Space management Conclusion 01 02 03 04
Introduction 01
Allocation method provides a way in which the disk will be utilized and the files will be accessed. Selection of an appropriate allocation method will significantly affect the performance and efficiency of the system. There are various methods which can be used to allocate disk space to the files. Introduction:
Allocation Methods 02
Allocation methods are as follows: Contiguous Allocation Linked Allocation Clustering FAT Indexed Allocation Linked Indexed Allocation Multilevel Indexed Allocation Inode
Contiguous Allocation If the blocks are allocated to the file in such a way that all the logical blocks of the file get the contiguous physical block in the hard disk then such allocation scheme is known as contiguous allocation.
Linked file allocation In linked list allocation, each file is considered as the linked list of disk blocks. However, the disks blocks allocated to a particular file need not to be contiguous on the disk. Each disk block allocated to a file contains a pointer which points to the next disk block allocated to the same file.
File Allocation Table File Allocation Table overcomes this drawback of linked list allocation. File allocation table needs to be cached in order to reduce the number of head seeks. Now the head doesn't need to traverse all the disk blocks in order to access one successive block. It simply accesses the file allocation table, read the desired block entry from there and access that block.
Indexed Allocation Instead of maintaining a file allocation table of all disk pointers, indexed allocation scheme stores all the disk pointers in one of the blocks called as Indexed block. Indexed block doesn't hold the file data, but it holds the pointers to all the disk blocks allocated to that particular file. Directory entry will only contain the index block address.
Multilevel Indexed Allocation In Multilevel index allocation, we have various levels of indices. There are outer level index blocks which contain the pointers to the inner level index blocks and the inner level index blocks contain the pointers to the file data . The outer level index is used to find the inner level index. The inner level index is used to find the desired data block.
Inode In UNIX based operating systems, each file is indexed by an Inode . Inode are the special disk block which is created with the creation of the file system. The number of files or directories in a file system depends on the number of Inodes in the file system.
Free space Management 03
Free Space Management A file system is responsible to allocate the free blocks to the file therefore it has to keep track of all the free blocks present in the disk. There are mainly two approaches by using which, the free blocks in the disk are managed. Bit vector. Linked list.
Bit vector In this approach, the free space list is implemented as a bit map vector. It contains the number of bits where each bit represents each block. If the block is empty then the bit is 1 otherwise it is 0. Initially all the blocks are empty therefore each bit in the bit map vector contains 1. LAs the space allocation proceeds, the file system starts allocating blocks to the files and setting the respective bit to 0.
Linked List It is another approach for free space management. This approach suggests linking together all the free blocks and keeping a pointer in the cache which points to the first free block. Therefore, all the free blocks on the disks will be linked together with a pointer. Whenever a block gets allocated, its previous free block will be linked to its next free block.
04 Conclusion
In this, we concluded that File allocation methods are an important aspect of computer operating systems, as they determine how files are stored and accessed on disk . Overall, the choice of free space management technique depends on the specific requirements of the operating system and the storage devices being used.