History of Unix, from the book "The Unix System V Environment", by Stephen R. Bourne. (Copyright 1987 Bell Telephone Laboratories, Addison-Wesley ISBN 0-201-18484-2.)

Chapter 1: Introduction

UNIX describes a family of computer operating systems developed at AT&T Bell Laboratories. The UNIX system includes both the operating system and its associated commands. The operating system manages the resources of the computing environment by providing a hierarchical file system, process management and other housekeeping functions. The commands provided include basic file and data management, editors, assemblers, compilers and text formatters. A powerful command interpreter is available that allows individual users or projects to tailer the environment to suit their own style by defining their own commands.

The background leading up to the first UNIX system is worth exploring. During the sixties major issues being addressed by the computing science community included programming language and operating system design. In the former area such languages as PL/I, APL, SIMULA 67, ALGOL 68 and COBOL were designed and were the subject of debate, often fierce, over their relative merits. In the United Kingdom the Combined Programming Language project (CPL) was undertaken jointly by London and Cambridge Universities but failed to produce any direct results. however, it did for the basis for BCPL (Basic CPL), an ingredient of the UNIX system story.

The operating systems of this period were designed for medium and large scale computers as a means of sharing the resources among users in a cost effective way. Time-sharing and interactive (as opposed to batch) use was introduced. Such questions as paging strategies, protection, activity scheduling and file system design were explored. Systems like CTSS (Crisman, 1965), Multics (Feiertag, 1969) and, in Europe, the Cambridge Multiple Access System (Hartley, 1968) were being designed and provided many of the key ideas found in the UNIX system. For example, file systems and device independent input-output, processes and command languages were all available in one form or another in these systems.

1.1 History

The story begins with Ken Thompson in 1968. Thompson had recently returned from Berkeley where Butler Lampson was working on the SDS930 operating system (Deutsch and lampson, 1965). Dennis Ritchie joined Bell Laboratories in 1967 from Harvard where his interest was applied mathematics.

Thompson shared space with a talented group many of whom had recently abandoned Multics; a joint project between Bell Laboratories, General Electric, and The massachusetts Institute of Technology. Following the withdrawal of Bell laboratories from Multics and the removal of the GE 645 system in March 1969, the computer science research group began looking for a replacement computing environment. Proposals for new equipment were submitted and rejected as too expensive. Also, operating system development was not a popular research direction after the Multics debacle.

Thompson's own interests were to build a file system rather than an operating system. During discussions between Rudd Canaday, Thompson and Ritchie the design was sketched out and Thompson wrote simulations of early versions of the file system on the GECOS system. Another thread ofthe story is the 'space travel' program written on the GECOS machine by Thompson and Ritchie. This program performed poorly on the time-shared computer and better response was needed. A cast-off PDP 7 with a 340 display was available but the PDP 7 provided only an assembler and a link editor. One user at a time could use the computer, each user having exclusive use of the machine. This environment was crude and parts of a single user UNIX system were soon forthcoming. The space travel program was rewritten for the PDP 7 and an assembler and rudimentary operating system kernel were written and cross assembled for the PDP 7 on the GECOS system. This early system did not provide time-sharing. indeed, much like the modern personal computers, the PDP 7 hardware was simple and provided no support for such activities. An assembler and a command interpreter were soon available. This file system provided a name structure that was a directed graph. A single directory was used for all subdirectories and links made through this directory.

Cross assembling meant using two computer systems and carrying paper tapes of programs from one to the other each time a change was made. The system was soon bootstrapped onto the PDP 7. The process creation primitive, fork, and process images were added to the system during this rewrite. Essential utilities, such as file copy, edit, remove, and print were soon available. This system supported two people working at the same time and the term UNIX was coined by Brian Kernighan in 1970.

The computing research group still had no computer of its own. Following a series of unsuccessful attempts a proposal was made by Joe Osanna to purchase a PDP 11/20 for a text preparation project. In late 1970 the PDP 11 arrived and work started to transfer the UNIX system to this more powerful machine.

The text processing project was successful and the Patent department became the first user of UNIX, sharing the facility with the research group. This First Edition system was documented in a manual authored by Thompson and Ritchie dated November 1971. All the important ideas found in modern UNIX systems except pipes, but including the file system, process management, system interface, and major command utilities, were provided with this edition.

The Second Edition appeared in June 1972 incorporating pipes at Doug McIlroy's urging. The system and utilities were still written in assembler. Thompson had also been working on the language B and the assembler for this system was written in B. B was a direct descendant of BCPL, but programs were compiled in one pass to produce interpretive code.

Both B and BCPL were typeless languages, providing a single data object called the machine word making access to the PDP 11 byte handling instructions difficult. Types were therefore added to B to produce NB and an attempt to rewrite the system in NB was unsuccessful. Ritchie started work on a code generator for NB to make execution of programs faster. This language was called C (Kernighan and Ritchie, 1978) although there were no structures or global variables. The language was sufficiently attractive, however, that new utilities were being written directly in C.

The year 1973 saw major progress. The system was still written in assembler but following the addition of structures to C the UNIX system was successfully rewritten in C. Thompson wrote the process management and Ritchie the input-output system.

The Sixth Edition UNIX system that became the first widely available version was issued in May 1975, and was distributed for a nominal fee.

Work continued to improve the system. A new file system allowing for larger files was written and the shell was modernized to provide better support for the many programs written in this language. This shell is the one described in this book and was designed and written during late 1975 and early 1976.

During 1977 Thompson and Ritchie began rewriting the system so that it could be transported from one computer to another. The pilot project used an Interdata 8/32, a 32-bit computer similar to the IBM 370 series, that was sufficiently different from the PDP 11 to unearth most machine dependencies. This project also generated some additions to the C language, including unions, casts, and type definitions. This work resulted in the production of the Seventh Edition UNIX system released for general use in 1979. Although the Seventh Edition is still in use in some installatioins it has been generally superseded by either UNIX System V or 4.2 BSD from U.C. Berkeley.

The UNIX system isnow regarded as a standard operating system and has been implemented on many different computers ranging from micros to mainframes. The Seventh Edition system was made available forthe PDP 11 16-bit computers. The first VAX 11/780 system, UNIX 32V, was bootstrapped by John Reiser and Tom London, also at Bell Laboratories. This system was further developed under a DARPA contract, and is now distributed by the University of California at Berkeley. AT&T has also continued to develop the UNIX system; UNIX System V Release 2 is the version currently available for license from AT&T.

Some differences exist between these versions both in the operating system and in the commands although these should cause the reader little difficulty. This text is applicable to each of these systems and features found in only one system have been avoided. The programs in this book have been compiled and run on UNIX System V from AT&T, and on the University of California, Berkeley Release 4.1.

Many commands were initially written for the PDP 11 where address space was limited to 64K bytes. This constraint had a generally beneficial effect on the software. Systems are designed as a set of loosely coupled commands. Lack of address space did prevent such languages as LISP from effective implementation until the arrival of 32-bit machines.

The UNIX system is well engineered and has set a standard of simplicity for time-shared operating systems. It was one of the first operating systems to be widely available on a mini-computer, namely the PDP 11. This combination was affordable by university departments and a generation of computer scientists has been educated on UNIX systems.

The initial interface has aged well and is essentially unchanged since its original design. This stability provided the basis for the development of the user level commands. The UNIX documentation has a conciseness that is appealing although some consider it to be too brief.

The UNIX system is very successful. At the time of writing there are over 3000 UNIX systems in active use throughout the world. These can be found in universities, government laboratories, commercial organizations and many other areas of industry. At Bell laboratories it is used by staff members both for interactive program development and as a communications and word processing system. The system is portable, easily grasped by both users and maintainers, and provides facilities not available in other, sometimes larger, systems.

Chapter 5: The C Programming Language C is the programming language used to write the UNIX operating system and most of its commands. The language was developed at the same time as the system was being written and has evolved to its current state over a decade. Both machine dependent and machine portable programs may be written and compilers for the language exist for many different machines although the first compiler was written for a PDP 11/45.

Historically C was influenced by BCPL, a language developed at M.I.T. and later at Cambridge University. The link between these two languages was through the language B.

BCPL is a typeless language that supports only one object, the machine word. All language operations are defined on words and storage is also allocated on this basis. The language is appealing because of its simplicity. A portable compiler was available in the lage 1960s and it was used for writingoperating systems.

The historical origins of C help explain some aspects of the language design. It was intended for systems programming and similarity to the machine was considered important. For example, the ++ operator has a direct equivalent in the PDP 11 instruction set. Features allowing portable programs to be written, such as unions, were added to the language in the late 1970's. Traces of the typeless origin of C can still be seen in the easy with which integers and characters, or pointers and integers, can be mixed in some implementations. Type checkingis also absent when parameters are passed to functions.

C provides different basic data objects such as int, char, float and double and also has types derivedby aggregation using arrays and structures. Other derived types include enumerations, pointers, unions and structures. The type structure of C is similar to languages like ALGOL 60 and Pascal. C differs in the strictness with which type mismatches are treated. Some C compilers will, for example, permit the assignment of a pointer value to an integer variable. In Pascal no semantics are defined for this operation and it is, therefore, not implemented. The permissive approach to types adopted in C allows programs such as storage allocators to be written provided some information is available about the implementation.

C provides standard control flow primitives such as if and switch for selection and while and for for iteration. In addition, functions may be defined to return values and can be called recursively. A function that returns no value maybe declared voidin a similar way to ALGOL 68.

This chapter introduces C as a language and also describes ways that C programs can e organized, maintained and debugged. C is used to describe the UNIX system calls in the next chapter.

More notes:

From 2.3 Terminal characteristics:

"Early UNIX systems used # and @ for character and line delete respectively and these are still the default; however for video terminals backspace is a convenient erase character." Remember, a teletype couldn't erase on paper, the example "passq#wd" was given as a way to type "passwd". Backslash escapes were used to type them as literals, \# and \@. Also, the "del" key (or sending a break on the serial line) was used instead of ctrl-c to terminate processes, and things like tab (both the key and proper interpretation of the tab character during output) weren't always available, it depended on the terminal you were using. Hence the "stty" command... Mention of ctrl-s and ctrl-q to suspend terminal output, also.


cat > newfile
text of file

Dos people did copy con: and ended with ctrl-Z (or F6).

Chapter 4: The Shell

Bourne notes, "Similarities exist with the command interpreters of the Cambridge Multiple Access System and of CTSS. The notation for simple commands and for aprameter passing and substitution is similar in these languages."

Also, note that "set -v" or "sh -v" is needed to echo each command line from a script as it's read; the default is not to do so. In dos, the first line of most batch files is "@echo off"...

5.1.2: octal dump. The pre-11 PDP systems were still in their heads, eh?

"Figure 5.4 illustrates typical storage requirements for the basic data types for the PDP 11/45 and VAX 11/780. On both machines ASCII is the character code used."

TypePDP 11/45VAX 11/780
short int1616
long int3232
6.4: Creating lock files. (Permission 0 later replaced by O_EXCL, because it didn't work for root; read permission wouldn't be denied to root.)

6.5: Processes. "There is a per use and a system wide limit to the number of processes that may be in existence at one time. For a typical VAX 11/780 these two limits are 50 and 250 respectively."

Chapter 7: Document preparation. It occurs to me that the online man page facility may have been somewhat accidental. The first PDP 11 unix was a text processing system (for the patent department), used to prepare printed documents. Unix's own printed manual was prepared on this system, using roff/nroff/troff and macros. Once it was on disk, printing out a specific man page was easier than going and getting the book. And with video display terminals instead of teletypes, it didn't waste paper to do it...

Who was using paper terminals and who was using VDTs? (The PDP-7 had a VDT...)

Random note: Bell Labs had four locations: Holmdel, NJ 07733, Murray Hill, NJ 07974, Whippany, NJ 07981, and Indian Hill (in Napierville, IL 60540).