This would lead to garbage blocks blocks that are

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ree blocks together. Disk compaction is a time consuming operation and may take several hour. Hence it is usually performed at night when the system is otherwise idle. 2. Another problem with this method is in determining how much space is needed for a file when it is created so that appropriate number of contiguous blocks can be found and allocated to the file. In general, it is difficult to estimate the size of an output file. If the size is over estimated, it will lead to unused disk space due to internal fragmentation. On the other hand, if the size is under estimated, the file will have to be moved completely to a new area on the disk when the file size grows beyond the originally estimated size. This often leads to external fragmentation problem and slower file access operations. Linked Allocation In this method, the set of disk blocks allocated to a file are linked together in the form of a linked list of blocks as shown in Figure 14.22. The first word of each disk block is used as a pointer to the next one, and the rest of the words in the block are used to store file data. Note that the disk blocks allocated to a file may be scattered anywhere on the disk. As shown in Figure 14.22, in this method, the disk address in the directory indicates the number of the first block allocated to each file. Linked 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 no 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. The method, however, has the following drawbacks: 1. The method can be used effectively only for sequential-access files. Random access of files in this method is extremely slow. For example, to access some data from the ih block of a file, we must start at the first block and follow the poin...
View Full Document

Ask a homework question - tutors are online