File management: Storage Allocation MethodsAbstractStorage allocation concerning file management is a particular complex topic to outline. The main methods of file management allocation are: contiguous, linked list, and indexed allocation. This paper overviews the different methods of file storage allocation, with its advantages and disadvantages, compare and contrast between them to choose the most appropriate method for storage allocation. It is challenging to determine which type of method is better than the other, because it comes down to the use or needs of the server, which method will be more efficient or will optimize the outcome or their requirements.
Hence, this paper motivation is to mainly outline the characteristics of each method to give the reader a clear idea of which method to choose above the ones described.IntroductionFile manager is one of the four main managers of the operating system, which maintains control of every file in the system. The file manager is the one who controls the file management.
File management is the administrator of the files, this is done through the operating system allowing users to have uninterrupted access to the files and have power over them, as well as sending and sharing files with other users, providing security and safety to these. It allows the user to accomplish certain operations with them, which are:1) File creation, define the space of it and recognizing it with a name2) Open the file, here you perform different operations such as its execution, read it, write in it.3) Remove to free space unavailable by this file.4) Close the file, end its execution.5) Altering the file for example modifying its name.A file is an ordered set of information of the same class or related to each other, it is stored in any part of the computer and is identified by a name. Files are stored in a directory where a group of info related to each other or “data files” are stored, in these directories you can find other directories called as subfolder. These serve for the organized improvement of the archives. This paper will overview the different methods of file storage allocation, with its advantages and disadvantages, compare and contrast between them to choose the most appropriate method for storage allocation.DiscussionFor file management storage allocation there are three methods: contiguous, linked list, and indexed allocation, which will be explained next, in order to make an analysis their key factors, advantages, disadvantages and example of how they work.Contiguous AllocationContiguous allocation method works by assigning each file blocks with contiguous logical addresses of the device (contiguous blocks on the disk). This method helps the processor by minimizing the number of searches and search time to access files and it is defined by the length of the area assigned to the file (number of blocks) and a disk address of the initial block. It is important to mention that this type of allocation allows sequential and direct access to the files. In figure 1, an example of how contiguous allocation works; for example, count it is stored in 0 block with a length of 2 blocks, that means it start in block 0 until block 1, or list starts in the block 28 with a length of 4 blocks and occupies from block 28 until the block 31. Figure 1: Contiguous AllocationIn the other hand contiguous allocation has its disadvantages and complications. When it comes to dynamic storage allocation, there are issues with the first fit strategies and better fit allocation methods because it selects a free space from the set of available spaces, where the file can be stored; therefore, making it tough for data insertion. When the file is stored in one of this methods, external fragmentation is generated especially when you delete a file, there is a gap that may not be used completely by another file. To solve this problem user may need to use compaction to free up space and create bigger blocks of space.Linked List AllocationIn linked list allocation the file, as the name states it, is stored as a linked list of disk blocks. This method stores files each as a linked list of blocks or row one after another, this consists in that the first bytes of each block are used as an initiator for the next and the remains are for the data. Where the blocks can be dispersed all over the disk, no need to be contiguous. The entry to the directory has a pointer to the first and last block of the file. In this type of method there is a jump between blocks, where each block has a pointer to the next block. In figure 2, an example of how linked list allocation works; for example, the file jeep is spread around the disc blocks linked with each other, the block 25 where it ends it is marked with a -1 indicating a null pointer where the file ends. Figure 2: Linked List AllocationA breakthrough of the method is that solved the problems of the contiguous, because there is no external fragmentation since there is no need to declare the size of a file at the time of creation. As long as there are free blocks, the files stored can keep growing while there is space. Additionally, there is no need to compact the disc (compaction) as previously stated with contiguous allocation. Moreover, the link between blocks remains simple and improves disk performance. Nonetheless, this method has its own disadvantages too, for instance, it is extremely slow, and the pointers or initiators for the next block take up space (space is used to save pointers, losing it to save information), we have a little less space in each block. It can only work most efficiently for sequential access files. A solution for these problems is collecting blocks in clusters and assigning clusters instead of blocks, this way less space is lost. Nevertheless, using clusters can create internal fragmentation, because more space is wasted when a cluster is partially full than when a block is partially full.It is important to mention that for this method is greatly improved by the creation File Allocation Table, which occupies a part of the main disk and has an input for every block of the disk. It helps to eliminate some disadvantages of the method like the pointers, joining them to each pointer and putting it in a table of file assignment. However, it can be very large, and you have to keep it in memory. Below, figure 3 shows an example of how a file allocation table is. Figure 3: File Allocation TableIndexed AllocationAlso called linked index blocks, similar to the linked list allocations, but it has the pointers all together in an index block, and an index block is created for every block. The ith entry of the index block points to the ith file block. The directory contains the address of the index block, and it supports direct access without external fragmentation. Unfortunately, this method has the disadvantage of wasting space (the pointers of the index block). For this reason, it is convenient that the block index be as small as possible (normally occupies a block of disk); however, if it is too small, it may not contain enough pointers as a large file requires. In figure 4, for example, the file jeep is spread around the disc blocks linked with each other, with the index block in the block 19. Figure 4: Indexed AllocationIt is important to notice that for this method that the absence of the file allocation table, efficient direct access (scattered pointers together with the blocks) can’t be implemented; therefore, all the pointers are gathered in the same place, index block (indexed assignment). The advantages of this method are that solves issues related to external fragmentation and the no need for anticipated files size.ConclusionAs shown before the three types allocation have their own advantages and disadvantages. Contiguous allocation has advantages such as supporting sequential and direct access, and specially that all the space is only used to store data, in comparison with the other two methods. In other hand, its disadvantages are principally the external fragmentation, so even though all space is used for storage there is fragmentation and compaction would be required. Additionally, it needs an anticipated file size to find space for the creation of a file. Even though its drawbacks, it still the faster to locate files in memory. Linked allocation has the advantage that external fragmentation does not occur, and it is not necessary to anticipate the size of the file in advance. Nonetheless, it is only efficient only for sequential access files and space is lost or occupied by pointer the pointers. Indexed Assignment, as linked, has the advantage that external fragmentation does not occur, and it is not necessary to declare the size of the file in advance. In contrary to linked, this method supports sequential and direct access of files. However, in this method there is greater loss of space due to block-rate use.In conclusion, it is hard to determine which type of method is better than the other. It can be recommended to use the best method that is most appropriate to the use. For example, for larger files would be better to use Index allocation, but for quick and fast memory access file would be better to use a contiguous allocation. Every method has its drawbacks, but it is important to discriminate and compare which method in the end will be more efficient for the purpose of the file storage usage.