1 1 1 2 2 2 2 2 2 3 3 4 4 4 free free Contiguous File Table File Number Start Block File Size 1 1 3 2 4 6 3 10 2 4 13 3 Figure 6.1 Contiguous File Allocation Linked Allocation Strategy Using the linked allocation strategy, the contents of a file can be stored anywhere on a disk (they do not need to be contiguous). The operating system maintains a file directory which contains the filename and the start block number. Each block of data belonging to a file contains a pointer, which points to the next block of data belonging to that file. The last block of data contains a special End of File (EOF) indicator, so that the operating system will know that it has retrieved all of the data for the file. Figure 6.2 right) shows the File Directory entry and the entries in the File Allocation Table fora sample file using the Linked allocation Strategy. The linked allocation strategy also has advantages and disadvantages. Advantages of the Linked Allocation Strategy No file fragmentation issues. Easy to expand the size of a file. File 1 120 File Directory 600 End of File (EOF) 480 0 120 240 360 480 600 720 File Allocation Table Figure 6.2 Linked Allocation Strategy
Operating System Fundamentals 80 Disadvantages of the Linked Allocation Strategy The pointers field for each block of data uses up storage space. There are some inefficiencies in the direct access of data.