Explain file allocation with contiguous allocation

3 years ago
Operating System

The allocation methods define how the files are stored in the disk blocks. There are three main disk space or file allocation methods.

⦁    Contiguous Allocation
⦁    Linked Allocation
⦁    Indexed Allocation

The main idea behind these methods is to provide:

⦁    Efficient disk space utilization.
⦁    Fast access to the file blocks.


All the three methods have below:

1. Contiguous Allocation
 their own advantages and disadvantages as discussed


In this scheme, each file occupies a contiguous set of blocks on the disk. For example,
if a file requires n blocks and is given a block b as the starting location, then the
⦁    | P a g e    U N I T 3

blocks assigned to the file will be: b, b+1, b+2,……b+n-1. This means that given the starting block address and the length of the file (in terms of blocks required), we can determine    the    blocks    occupied    by    the    file. The directory entry for a file with contiguous allocation contains

⦁    Address of starting block
⦁    Length of the allocated portion.

The file ‘mail’ in the following figure starts from the block 19 with length = 6 blocks. Therefore, it occupies 19, 20, 21, 22, 23, 24 blocks.

Advantages:

⦁    Both the Sequential and Direct Accesses are supported by this. For direct access, the address of the kth block of the file which starts at block b can easily be obtained as (b+k).
⦁    This is extremely fast since the number of seeks are minimal because of
⦁    memory at a particular instance.
⦁    contiguous allocation of file blocks.

Disadvantages:

⦁    This method suffers from both internal and external fragmentation. This makes it inefficient in terms of memory utilization.
⦁    Increasing file size is difficult because it depends on the availability of contiguous

0
Sanisha Maharjan
Jan 14, 2022
More related questions

Questions Bank

View all Questions