The UNIX Time-Sharing System Dennis M. Ritchie and Ken Thompson - 1974 ----------------------------------------- Summary: This paper describes the UNIX operating system with a focus on what the authors believe is its most important role, providing a file system. Three kinds of files: 1. Ordinary: These files can contain any information the user wants (e.g., text, binary, etc.). The system doesn't enforce any particular structure, so if a user program requires files with a certain structure, that has to be enforced in the the user program. 2. Directory: These files provide structure by mapping names of files to the files themselves. A directory behaves like an ordinary file except that it cannot be written on by unprivileged programs; thus, the system controls the contents (and format) of the these files. Linking: The same nondirectory file may appear in several directories under possibly different names. Thus, a file does not exist within a particular directory. The directory entry for a file consists of its name and a pointer to the file's i-node. Links to directories are not allowed to simplify the writing of programs that visit subtrees of the directory structure and to avoid the separation of portions of the hierarchy. 3. Special: These files represent I/O devices. The advantages of treating devices as files are threefold: 1. similar interfaces for file and device I/O, 2. file and device names have the same syntax and meaning so that a program expecting a file name can be passed a device name, and 3. special files are subject to the same protection mechanism as normal files. Miscellaneous points: - Mounting file systems: No link may exist between one file system hierarchy and another. This avoids elaborate bookkeeping required to assure that links are removed when unmounting a file system. - Locks: UNIX does not have file locks because they are neither necessary nor sufficient. They are unnecessary because there are typically not large single-file databases maintained by independent processes. They are insufficient because locks that prevent a user from writing a file which another user is reading cannot prevent confusion when, for example, both users are editing a file with an editor which makes a copy of the file being edited. - i-list: When the file is accessed, its i-number is used as an index into a system table (i-list) stored in a known part of the device on which the directory resides. This table contains i-node information (e.g., last modification, reference count, etc.). This way of organizing the file system permits a simple and rapid way for checking file system consistency since only the linear i-list needs to be checked.