Chapter 12, part 1
Chapter 12 begins with a discussion about file and secondary storage, but does not mention the difference between them. The usual way to view the two related concepts is that file storage is immediately available to a user, while secondary storage may take more time or effort to access.
The text tells us that a file management system (FMS) is typically part of the OS of any system, as we learned in the chapter on operating systems. The author discusses four layers of an FMS and relates them to the four layers of an OS:
In the table above, the user interface is at the top of each column, and the hardware interface is at the bottom. The author's discussion on page 447 begins with the bottom layer.
The text uses vocabulary in this chapter that is specific to the topic. It has already used the word directory a few times. If this work bothers you, it means the same thing as the word folder, when used with regard to file systems. a number of terms are used when we are talking about the logical structure of the FMS:
The logical structure of the FMS gives the user a way to organize and manipulate data. The physical structure of the FMS has to do with the actual devices being used for storage, and is independent of the logical structure. Users are typically not exposed to the physical structure of the FMS.
The text reminds us that files come in many types, and the FMS must be able to store and use all of them. In general, files typically fall into one of several types that are recognized by an FMS, often recognizable by their file extensions:
The text is a little unclear on page 451. It should tell us that a directory can store files and other directories, and that it also stores information about those files and directories. This information is available to users in a number of formats, depending on the OS, and usually included the following properties:
In any directory, each filename must be unique, which may not be apparent in systems that only display a portion of each file's name. Filenames have restrictions in some file systems that do not exist in others. For instance, UNIX and Linux systems would see file1, File1, and FILE1 as three different filenames. Windows would see all three as the same name, because it does not care about the case of the characters in a filename. The text reminds us that older DOS (Disk Operating System) versions restricted filenames to no more than eight characters, followed by a dot, followed by no more than three more characters in the file extension. This was called the 8.3 format for filenames. Microsoft removed this restriction in Windows 95 and Windows NT 3.51, so names of that sort are now referred to as Short Filenames.
On page 452, the text list some of the access controls, rights to manipulate a file, that may be assigned to individuals or groups:
As we have noted above, a directory can contain another directory, creating a parent-child relationship between them. The text notes that a directory may have multiple children, but it may only have one immediate parent. This is the nature of a hierarchical relationship: a file or directory must have a single. specific path from its current location up to the root of the volume in which it presently exists.
On page 453, the text shows us a classic view of a file system using a hierarchical structure. In this case it starts at a computer, which is the parent to a local disk (C:) and a network volume (T:), which is the parent to many folders (directories), and the files inside one selected folder are displayed in panel on the right. The currently selected directory is usually just called the current directory. The text also calls the current directory the working directory, but this phrase also refers to whichever directory an application has been coded to use when creating the temporary files it needs while it runs.
The text describes a complete description of the path to a file as its complete path, or fully qualified reference. In such a path, the usual symbol used to show progression from one directory to another is either a slash (/) or a backslash (\). Slashes are used in UNIX, Linux, and HTTP notation references. Backslashes are used in Microsoft notation references.
The text also discusses the idea of reference that will take you from one place in a directory structure directly to another place. In UNIX derived systems this is called a link (just like on the world wide web) and in Microsoft systems it is called a shortcut.
The text moves on to discuss storage allocation. Files take up a minimum amount of space, regardless of how small they are. This minimum space is referred to as a file allocation unit, which is also called a cluster. The size of a cluster or FAU varies with the OS, the choices the user makes, and the size of the volume involved. The larger the volume, the larger the FAU has to be. Think of clusters as being logical aspects of a disk that are dealt with by the Operating System. A cluster is defined as the smallest unit on a disk that the operating system can read from or write to at one time.
This is a chart of cluster sizes for various logical drive sizes using FAT12, FAT16, FAT32, and NTFS. For another view of the same data, see this page at the Microsoft Help and Support site.
The OS keeps track of the allocation of space with a Storage Allocation Table, in which all the possible space is represented, and the currently allocated space is marked as such. An example of such a table appears on page 457. Note that it shows blocks allocated to the same file in the same color. (The white ones are not in use. They are allocated to a file called SysFree.) Note also that the table lists a pointer for each block. A pointer is usually a variable that remembers a memory address. In this case, it remembers the location of the next block that holds a part of the allocated file.
Let's move on to File Manipulation on page 461. As most programmers will tell you, the basic actions you code in a program typically relate to opening a file, reading it, writing to it, and closing it. The text inserts a series of five steps that the FMS must take before opening the file:
Open files must be closed when a process is done with them. The text provides four steps the FMS will follow when you are done with a file:
Deleting files is sometimes more complicated than it sounds. Instead of erasing the file from storage, the OS may just mark the FAUs allocated to the file as free, and remove the entry for the file from the directory table it appears in. The FAUs will be used the next time they are needed, and are as likely to be used for the next file that requires space as any other FAUs. This means that they may be unused for a while, and that the file they still hold might be undeleted until the FAUs are allocated and used. This also means that someone trying to harvest information from the storage device might be able to harvest that file or portions of it.
The text discusses access controls again, starting on page 462.The three classic UNIX permissions are listed in bullets on that page:
In UNIX, these rights are typically assigned or denied to three user classes: the user who owns the file, any group the user belongs to, and every other user on the system.