In a file allocation system, which of the following allocation scheme(...
In contiguous allocation there is always possibility of external fragmentation. Both indexed and linked allocation are free from external fragmentation.
Therefore, option D
View all questions of this test
In a file allocation system, which of the following allocation scheme(...
Contiguous Allocation:
In a contiguous allocation scheme, each file is allocated a continuous block of memory on the storage device. This means that the file is stored in a single continuous section of the storage media. To access the file, the starting address of the file is known, and the entire file can be read or written sequentially.
Advantages:
- Fast and efficient access to files.
- Simple implementation.
Disadvantages:
- External fragmentation can occur as files are allocated in contiguous blocks, leading to inefficient use of storage space.
- It is difficult to allocate larger files, as contiguous blocks of sufficient size may not be available.
Linked Allocation:
In a linked allocation scheme, each file is divided into blocks or nodes, and these blocks are linked together using pointers. Each block contains a pointer to the next block in the file. To access a file, the starting block address is known, and the blocks are traversed sequentially using the pointers.
Advantages:
- No external fragmentation as files can be allocated in non-contiguous blocks.
- Easy to allocate files of varying sizes.
Disadvantages:
- Random access to a specific part of the file is slower compared to contiguous allocation, as each block needs to be accessed sequentially.
Indexed Allocation:
In an indexed allocation scheme, a separate index block is maintained for each file. This index block contains a list of pointers to the blocks that make up the file. To access a file, the index block is first accessed using a file control block, and then the blocks of the file are accessed using the pointers in the index block.
Advantages:
- No external fragmentation as files can be allocated in non-contiguous blocks.
- Efficient access to files, as the index block allows random access to any block of the file.
Disadvantages:
- Additional overhead of maintaining the index block for each file.
- Limited by the size of the index block, as it can only store a certain number of pointers.
Conclusion:
In this question, the requirement is that no external fragmentation is allowed. Contiguous allocation can lead to external fragmentation, as files need to be allocated in contiguous blocks. Linked allocation and indexed allocation can both be used to avoid external fragmentation, as they allow files to be allocated in non-contiguous blocks. Therefore, the correct answer is option D, which states that both linked allocation and indexed allocation can be used if no external fragmentation is allowed.
In a file allocation system, which of the following allocation scheme(...