13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

222 File Structures Chapter 6Figure 6.13 A huge file6.3 Disk layoutThe disk is divided into different regions that serve different purposes. As we have mentioned,subdisks can be built to promote clustering. Subdisks also allow administrators tosegregate files pertaining to different projects and to limit the amount of disk space eachproject uses. File descriptors occupy fixed locations on each subdisk. The root of a multileveldirectory structure should be easy to find. One easy way to do that is to let the firstdescriptor in file descriptor space represent the root directory. In a flat or two-level structure,the main directory must be similarly easy to find.When the operating system is started, it must be able to tell the structure of the diskby examining the disk itself. A disk descriptor could be stored at a fixed location (forexample, block 0) that indicates how many subdisks there are and how many blocks offile descriptor are stored on each subdisk. It would also include the bit map of freetracks, free cylinders, or free blocks. As we have seen, free blocks might be arranged ina linked list or a tree; pointers to this structure belong in the disk descriptor. The diskdescriptor might be stored in several places on the disk, because if the disk develops aflaw, some blocks may become unreadable. It is a disaster if the only copy of the diskdescriptor becomes unreadable.When a disk is formatted, bad sectors are detected by the disk controller and maybe sequestered so that they are no longer addressible. Occasionally, sectors become badafter formatting. These sectors may be placed in a ‘‘bad-sector file,’’ which is otherwisenever accessed and is not placed in any directory. In this way, bad sectors are placed outof harm’s way. Fancy archiving programs that read sectors directly from the diskwithout going through directories must be aware of the bad-sector file to avoid reading it.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!