This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ters
until we get to the ith block. This is slow because each access to a pointer requires
accessing a new block that requires a disk read operation.
2. Another problem is reliability. Since the blocks allocated to a file are linked
together by pointers scattered all over the disk, if a pointer were lost due to disk
corruption, all file data beyond that disk block would become inaccessible. This
would lead to garbage blocks, blocks that are neither free nor being used, and
would require implementation of a garbage collection algorithm. This algorithm
searches for garbage blocks and adds them to the list of free disk blocks.
In this method also, the disk blocks allocated to a file may be scattered anywhere
on the disk. However, unlike linked allocation in which the set of blocks allocated
to a file are linked together in a linked list, in this method the pointers to the set of
blocks allocated to a file are stored together in a special block known as index
block. Thus, each file has its own index block, which is an array of disk block
addresses. The i'h entry in the index block points to the i' h block of the file. As
shown in Figure 14.23, in this method, the disk address in the directory indicates
the number of the index block allocated to each file.
Indexed disk space allocation method has the following advantages:
1. There is no external fragmentation in this method. Every disk block can be
used. Since there is loss of disk space due to external fragmentation, there is no
need to implement disk compaction facility. 2. There is no need to determine and declare the total anticipated size of a file at
the time of its creation. A file can freely grow at any time since new disk blocks
required to be allocated to the file may be anywhere on the disk.
3. The method can be effectively used for both random-access and sequentialaccess files. Once the index block of a file has been loaded into the memory
(which is done when the file is opened for use), the block corresponding to any
part of the file can be directly access...
View Full Document
- Spring '14