P1: JDW
UNIX WL040/Bidgoli-Vol III-Ch-41 August 13, 2003 17:26 Char Count= 0
THEUNIXPHILOSOPHY 509functionality you need is not in Microsoft Word, you are
out of luck.
Now certainly the decision to use a common textual
stream format has performance implications, but another
fundamental philosophical tenet of the original design-
ers is that Unix is predisposed to favor interoperability
and portability over raw speed. It was assumed that faster
hardware could always be deployed to speed up two pro-
grams that were communicating but that nothing could
be done without serious labor to help two extremely fast
programs that couldn’t communicate because they each
dealt with mutually incompatible data formats. So inter-
operability is preferred as a fundamental principle over
speed.Everything Is a File
One could almost say that one effect of the hierarchical file
system concept was that the designers of Unix liked files
so much that they decided to make everything a file. When
Brian Kernighan and Rob Pike published their landmark
Unix programming book,The Unix Programming Environ-
ment,the first sentence of the chapter on the file system
simply stated the following: “Everything in the UNIX sys-
tem is a file” (Kernighan & Pike, 1984, 41). It is not so
much that every thing in Unix is a file, but that so many
devices in Unix conform to the same abstract pattern;
they follow the same, consistent API. That is, whether a
user is opening a regular file on a disk, writing to a tape
drive, reading characters from a modem, printing some-
thing to a printer, writing out to a pipe, writing out to a
socket, or doing just about anything else, the process im-
plies reading and writing bytes of data. This means they
are using the same core set of system functions to access
the file: open(), creat(), read(), write(), and close(). As far
as the programmer is concerned, each of these types of
“files” is just another stream of bytes to be read from and
written to.
The device abstraction isolates the programmer from
the details of how a particular devices actually works. So
through the standard file system calls, the programmer
is relieved from the details of knowing how to advance a
tape physically, how to communicate with a serial port,
and so on. These details are hidden from the program-
mer within the respective drivers in the operating system,
but these devices are all accessible behind a common and
consistent interface. This sort of consistency also aided
Unix’s adoption, promotion, and success.Central Priorities
Portability
Writing to a common data format brings up the empha-
sis on portability. One of the key problems with operating
systems before Multics was that they tended to be writ-
ten in a machine-dependent assembly language. Porting
operating systems from one hardware platform to another
was very labor intensive. With the Multics and Unix em-
phasis on writing programs (including the operating sys-
tem itself) in a portable language, the benefits of reuse be-
came apparent. Source code could now be recompiled on
another computer with an assembler program, and with
(usually) a relative minimum of fuss, that program wouldnow run on the new system. One of the primary reasons
DARPA adopted BSD Unix over DEC’s proprietary VMS
operating system was that Unix was portable to future
hardware platforms, whereas VMS was written specifi-
cally for the VAX and would have to therefore be rewrit-
ten in assembler for every new hardware platform to come
along.Simplicity
There is a certain parsimoniousness about Unix. It is evi-
denced in a new user’s complaints that no output is gener-
ated from a command when it succeeds. The reasons for
this are several. First, if the line “Congratulations, your
command succeeded” is printed out by a program, it can-
not therefore function as a filter because the “success”
message would be output rather than the modified input
stream. It will always print out the congratulatory mes-
sage. Second, Unix was initially developed on teletype ter-
minals (the device representing a terminal in Unix is tty, a
unixism for TeleTYpe), that could print out some 30-odd
characters a second, certainly slow by today’s standards,
but not too cumbersome in the 1960s. At least user could
see the interaction between themselves and the computer.
Nevertheless, teletype terminals were slow, and any way to
minimize the unnecessary writing of output was to be pre-
ferred. Thus, generic success messages were to be avoided.
This also explains, in part, why so many Unix commands
are only one or two characters in length: wc, ls, db, du, ed,
ld, ln, mv, ar, as, b, to name a few. The fewer characters to
type, the faster the command could be executed.
Driven from its Multics and PDP 7 roots, Unix has al-
ways had a penchant for simplicity, which can be seen
in the earliest releases of Unix. The sixth edition of the
Unix operating system had less than 10,000 lines of code
in it. By contrast, Microsoft’s Windows NT 5.0 operating
system is reputed to have more than 40 million lines of
source code. Even now, with modern commercial Unix
systems available, the source code lines still do not ap-
proach anywhere near that number. Never has there been
an attempt to write a single Unix program that attempted
to be all things to all people.Elegance
One of the definitions for elegance in Webster’sNew World
Dictionaryis that of “restrained opulence.” Oxymorons
can often be enlightening, and this one is no exception.
There is something restrained and nevertheless opulent
about Unix. The restraint comes in its fundamental prin-
ciples of smallness and simplicity. Yet there is a certain
wealth afforded to the Unix practitioner, and this comes
in the wealth of opportunity those small utilities offer. This
wealth drives from the openness of the operating system
itself. Because of the toolbox practice, larger tools can al-
ways be constructed from smaller ones, and the essence
of Unix elegance is exhibited in the old dictum that the
whole is worth more than the sum of the parts. Unix’s ele-
gance does, however, put an expectation on users: They
must use their imaginations in defining whatever new
tools they needs or desire. Unix provides simple tools that
do simple things. The elegance derives in large part from
what the programmer brings to the tools in terms of vi-
sion and design. The tools are there available for use. The