The file system tracks free clusters, and allocates clusters of space to files as necessary. The wasted
space within a file due to unused space in the last cluster is internal fragmentation with respect to the file system.
Directories and Directory Entries
Today almost all operating systems represent the file system organization as a tree of directories and
subdirectories. The directory entry for a file will contain information such as the file name, permissions, time
of last access, time of last modification, owner, file size, and location of the data on the disk.
When a file is opened by a process, information from the directory is copied to an in-memory data structure
often called a file control block or an open file descriptor. In addition to the information from the directory entry,
the file control block may have information about read and write locks on the file, and the current state of the
file (open or closed, for reading or writing).
An interesting approach taken by UNIX was to make directories files. A directory is just a file that contains
information about files. This sort of stunningly simple consistency is part of the charm of UNIX for its admirers.
File Space Allocation
There are several general approaches to allocating file space.
Pages:
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341