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.

Physical representation 219date (for automatic deletion), number of aliases (for reclamation after deletion from adirectory), and file type. In contrast, pointers to the blocks that hold the file contentsmight require any amount of space. For the following discussion, we will assume thatthe file is constructed in extents, each of which comprises a number of contiguous blocks.We need to store the length and starting block for each extent.One organization is to place length and starting-block information for the firstextent in the file descriptor and to reserve space in each extent to describe the next one.This linked organization is fine for sequential access but clumsy for direct access.Alternatively, the file descriptor could contain information about every extent.However, it would be wasteful to allocate enough overhead space in each file descriptorfor the largest possible file. Instead, a fixed number of pointers may be stored and anindirect scheme used if the file is larger. Most files are very short. (A recent study at theUniversity of Wisconsin showed that about 42 percent of all files on a Unix installationfor a research community fit within one block, and 73 percent fit within five blocks. Asimilar study at Los Alamos Scientific Laboratory showed that half the files were smallerthan 40K bytes, whereas many files reached 10M bytes or larger.) We might thereforelimit the storage in the file descriptor to describe ten extents, for example. If extents canbe arbitrary in size, we are able to represent very large files this way, but if extents aretypically one block long, we can deal only with relatively short files.Figure 6.11 shows the format of such a file descriptor. The descriptor has room fora ten-block file. The particular file it represents uses only three blocks. For simplicity,the figure omits all the other information that might be stored in the descriptor.If a file grows too large for the file descriptor, we could reorganize it, at some cost,to collapse some of its extents. That is, we could try to find free space on the disk largeenough to hold two or more extents of the file. We would copy those extents into the freespace and modify the descriptor appropriately.otherinfoFigure 6.11 A three-block file

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

Saved successfully!

Ooh no, something went wrong!