Saturday, June 1, 2013
Management of space of the secondary data storage devices is one of the most necessary functions of the file system. This includes tracking which blocks of memory or disk are being allocated to the files and which blocks are free to be allocated.
There are two main problems faced by the system during allocation of the space to different files. Firstly, the access to the files has to be fast and secondly, the disk space has to be effectively utilized. Both of these combine to form the big problem of disk management. These two problems are more common with the physical memory of the system.
However, the secondary storage of the system also introduces 2 additional problems which are long disk access time and blocks of larger size to deal with. In spite of all these problems, there are considerations that are common for both the storage such as the non – contiguous and contiguous space allocation.
The following are the 3 widely used allocation techniques:
- The linked and the indexed allocation techniques fall under the category of the non-contiguous space allocation.
- All the methods have their own pros and cons.
- It is in the term of blocks that all the input and output operations are carried out on the disk.
- Software is responsible for converting from the logical record to physical storage blocks.
- This allocation technique assigns only the contiguous memory blocks to the files.
- The size of the memory required is mentioned by the user in advance for the holding the file.
- The file is then created only if that much amount of memory is available otherwise not.
- It is the advantage of the contiguous memory allocation technique that all the successive file records are saved adjacent to each other physically.
- This causes an increase on the disk access time of the files.
- This can be concluded from the fact that if the files are scattered all about the disk, then it takes a lot more time to access them.
- Accessing files when they have been organized in a proper order is quite easy.
- To access the files sequentially, the system uses the address of the last memory block and if required moves to the next one.
- Both direct and sequential accesses are supported by the contiguous memory allocation technique.
- The problem with this allocation method is that every time a new contiguous space cannot be found for the new files if a majority of the memory is already in use and if the file size is larger than the available memory.
Non–Contiguous Memory Allocation:
- It happens a lot of time that the files grow or shrink in size with usage and time.
- Therefore, it becomes difficult to determine the exact space required for the files since the users do not have any advance knowledge about the growing size of their files.
- This is why the systems using the contiguous memory allocation techniques are being replaced by the ones with the non-contiguous storage allocation which is more practical and dynamic in nature.
- The linked allocation technique mentioned above in the article, is a disk – based implementation of the linked list.
- Each file is considered to be a list of the disk blocks linked to each other.
- It does not matter whether the blocks are scattered about the disk.
- In each block, few bytes are reserved for storing the address of the next block in chain.
- The pointer to the first and the last block of the file is stored in the directory.