Describe advantages and disadvantages of each allocation method for disk space.
Contiguous allocation means all the space of files are allocated in a contiguous memory and with a fixed elementary size.
There are two advantages. First, the implementation is easy. Second, it can support random access and go to the next part of a file is easy.
There are two disadvantages. First, it is hard to find a free space for a new file, which is also called a dynamic storage-allocation problem. Since after some files are removed from the whole space, what left are free space with different size. Another problem is to determine the space for a new file, we dont know the size of a file in previous. It may costs a lot of waste of the memory.
Linked allocation means a file is stored by several indpedent blocks in different postitions of the memory. It has head block, body blocks and end block, each blocks expect for the end block has a pointer which points to the next block. For each file, the head block and end block is stored in the directory.
The advantage is that it solves all the disadvantages of contiguous allocation.
The disadvantage is that it only support sequence access. Another problem is that the pointers may take up some memory. The third problem is that the reability of this method is low, since the pointer may lost.
Indexed allocation is an improvment to the linked allocation, it collects each pointers of a file and list them together by sequence.
The advantange is that it get rid of the fragement problem.
The shortcoming is that it cant support random access. And the size of a file is determined by the size of index blocks, several methods like multilevel index is needed to solve the problem.