366 Electronic version recreated by Eric A. Brewer
University of California at Berkeley
Communications July 1974
of Volume 17
the ACM Number 7
software mentioned above can require as little as 50K bytes
of core altogether.
The
PDP-11 has a 1M byte fixed-head disk, used for file
system storage and swapping, four moving-head disk drives
which each provide 2.5M bytes on removable disk car-
tridges, and a single moving-head disk drive which uses
removable 40M byte disk packs. There are also a high-
speed paper tape reader-punch, nine-track magnetic tape,
and D-tape (a variety of magnetic tape facility in which
individual records may be addressed and rewritten).
Besides the console typewriter, there are 14 variable-speed
communications interfaces attached to 100-series datasets
and a 201 dataset interface used primarily for spooling
printout to a communal line printer. There are also several
one-of-a-kind devices including a Picturephone
®
interface,
a voice response unit, a voice synthesizer, a phototypesetter,
a digital switching network, and a satellite
PDP-11/20 which
generates vectors, curves, and characters on a Tektronix 611
storage-tube display.
The greater part of
UNIX software is written in the
above-mentioned C language [6]. Early versions of the
operating system were written in assembly language, but
during the summer of 1973, it was rewritten in C. The size
of the new system is about one third greater than the old.
Since the new system is not only much easier to understand
and to modify but also includes many functional improve-
ments, including multiprogramming and the ability to share
reentrant code among several user programs, we considered
this increase in size quite acceptable.
3. The File System
The most important job of
UNIX is to provide a file sys-
tem. From the point of view of the user, there are three
kinds of files: ordinary disk files, directories, and special
files.
3.1 Ordinary Files
A file contains whatever information the user places on
it, for example symbolic or binary (object) programs. No
particular structuring is expected by the system. Files of
text consist simply of a string of characters, with lines
demarcated by the new-line character. Binary programs are
sequences of words as they will appear in core memory
when the program starts executing. A few user programs
manipulate files with more structure: the assembler gener-
ates and the loader expects an object file in a particular for-
mat. However, the structure of files is controlled by the
programs which use them, not by the system.
3.2 Directories
Directories provide the mapping between the names of
files and the files themselves, and thus induce a structure on
the file system as a whole. Each user has a directory of his
own files; he may also create subdirectories to contain
groups of files conveniently treated together. A directory
behaves exactly like an ordinary file except that it cannot be
written on by unprivileged programs, so that the system
controls the contents of directories. However, anyone with
appropriate permission may read a directory just like any
other file.
The system maintains several directories for its own
use. One of these is the root directory. All files in the sys-
tem can be found by tracing a path through a chain of direc-
tories until the desired file is reached. The starting point for
such searches is often the root. Another system directory
contains all the programs provided for general use; that is,
all the commands. As will be seen however, it is by no
means necessary that a program reside in this directory for
it to be executed.
Files are named by sequences of 14 or fewer charac-
ters. When the name of a file is specified to the system, it
may be in the form of a path name, which is a sequence of
directory names separated by slashes “/” and ending in a
file name. If the sequence begins with a slash, the search
begins in the root directory. The name /alpha/beta/gamma
causes the system to search the root for directory alpha,
then to search alpha for beta, finally to find gamma in beta.
Gamma may be an ordinary file, a directory, or a special
file. As a limiting case, the name “/” refers to the root itself.
A path name not starting with “/” causes the system to
begin the search in the user’s current directory. Thus, the
name alpha/beta specifies the file named beta in subdirec-
tory alpha of the current directory. The simplest kind of
name, for example alpha, refers to a file which itself is
found in the current directory. As another limiting case, the
null file name refers to the current directory.
The same nondirectory file may appear in several
directories under possibly different names. This feature is
called linking; a directory entry for a file is sometimes
called a link.
UNIX differs from other systems in which link-
ing is permitted in that all links to a file have equal status.
That is, a file does not exist within a particular directory;
the directory entry for a file consists merely of its name and
a pointer to the information actually describing the file.
Thus a file exists independently of any directory entry,
although in practice a file is made to disappear along with
the last link to it.
Each directory always has at least two entries. The
name in each directory refers to the directory itself. Thus a
program may read the current directory under the name “.”
without knowing its complete path name. The name “..” by
convention refers to the parent of the directory in which it
appears, that is, to the directory in which it was created.
The directory structure is constrained to have the form
of a rooted tree. Except for the special entries “.” and “..”,
each directory must appear as an entry in exactly one other,
which is its parent. The reason for this is to simplify the
writing of programs which visit subtrees of the directory