In general it is difficult to estimate the size of an

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: lock is normally a multiple of page size in systems that use paging mechanism for memory management. Disk space is allocated to files in units of blocks. It is possible to read a block from the disk, to modify the block, and write it back into the same place. Contiguous Allocation In this method, each file occupies a set of contiguous blocks on the disk. Thus if a disk has 2K blocks, a file of size 1 IK will be allocated 6 contiguous blocks. As shown in Figure 14.21, in this method, the disk addresses in the directory indicate the starting block number and the total number of blocks allocated to each file. Contiguous disk space allocation has the following advantages: 1. It is simple to implement. 2. Its performance is excellent because the entire file can be read from the disk in a single operation. 3. It easily supports both sequential and direct access because all the blocks allocated to a file contiguous. File Name File attributes Disk address Starting Total number block of number blocks ! 0 3 19 6 29 8 5 4 A — B — C — D — Directory File 'A' Occupies 3 blocks numbered 0, 1 and 2. File 'B' occupies 6 blocks numbered 19, 20, 21, 22, 23 and 24. File 'C occupies 8 blocks numbered 29, 30, 31, 32, 33, 34, 35 and 36. File 'D' occupies 4 blocks numbered 5, 6, 7 and 8. Figure 14.21. Illustrating allocation of disk blocks to files in contiguous allocation method. This method, however, has the following drawbacks: 1. It suffers from external fragmentation problem. External fragmentation is a situation when enough total free disk blocks exist to satisfy the disk space requirement of a file, but still the file cannot be stored because the available free disk blocks are not contiguous. The amount of unusable disk space due to external fragmentation depends on the total disk space and the average disk space requirement of the files. However, statistical analysis indicates that as much as one-third of disk space may be unusable due to external fragmentation. To take care of this problem, systems which use contiguous disk space allocation method often provide the facility of disk compaction which moves files to bring all f...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online