Allocation-Methods

File System Implementation or Allocations

Edit

Q     Explain in detail file system and its implementation.    -------- May 2017.  ( 7 M )
Ans :    An important function of the file system is to manage space on the secondary storage
    * Technique of allocation of disk block  
a) Contiguous Allocation :- In contiguous allocation, files are assigned to contiguous area of secondary storage.          

                                                               File         Start      Size ( in blocks )

                                                               F1           1                              4             

                                                               F2           7                              7

                                                                F3           18                           2

                                                                                                                               Directory

Contiguous Allocation

In contiguous allocation , user specifies in advance the size of the area needed to hold a file before creation. If the desired amount of contiguous space is not available, the file cannot be created. This scheme is very simple. The disadvantage with contiguous allocation is external fragmentation

b) Linked Allocation File tend to grow and shrink dynamically. It is very difficult for uses to know in advance the size of the file. Link allocation is essentially a disk based version of linked list. In linked allocation, allocation list of blocks to a file is a linked list of blocks. These blocks may be scattered through the disk. These blocks need not be contiguous. Each block contains address of next block.

 Linked Allocation

Advantages     
1) Simple to implement
 2) no external fragmentation
Disadvantages      
1) Slow accessing of record
2) Wastage of space for pointers

c) Indexed Allocation :- One disadvantage with linked allocation method is that it does not support direct accessing as allocated blocks are linked together. This problem is solved by indexed allocation by placing all of the pointers together into an index block. In this scheme, each file is provided with an index block. An index block contains an array of disk blocks allocated to the said file. Following blocks are allocated to the file F1 : 6, 8, 13, 21

 Indexed Allocation

References

Edit
  • WikiNote Foundation

Last modified: Friday, 20 September 2019, 3:31 PM