The UNIX Time-Sharing System

Original paper by Dennis M. Ritchie and Ken Thompson: https://dl.acm.org/doi/10.1145/361011.361061

The paper “The UNIX Time-Sharing System” written by Dennis M. Ritchie and Ken Thompson, presents the main aspects of the UNIX Operating System, exposing the details on how its file system works and how it was implemented, highlighting the folder’s structure, permissions, special files and, the shell, the interface used by users to interact with the UNIX system.

The authors start presenting in the “File System” section, the 3 main structures that compose the UNIX file system: files, folders, and special files. In this section, it’s highlighted the important role the special files play, being used to identify the I/O devices managed by the OS. This is a pretty interesting strategy, that makes it easy for programs to interact with the UNIX devices, since there are no distinctions for the program, to handle a file or a device.

Followed by the file system section, the authors present aspects of how the I/O happens in UNIX, being the read and write operations designed to not make distinctions between sequential or random write operations, where only moving the read or write pointer into the desired file section. It’s curious to notice that the entire file system structure stores in its single nodes of the three all important information about the corresponding file: its name, size, and identification bits used for permissions and file integrity checking, which makes the verification of any file information pretty easy. UNIX processes are also presented in a comparison with images, being images understood as a given state of a pseudo-computational environment, while the process is effectively an execution of an image. This is an important concept broadly used in system calls performed to create a new process, such as the fork function, that whenever it’s called it returns 2 new processes containing different copies of the original image. Process communicates with each other through a presented structure named pipes, that returns file descriptors containing the data necessary for the children processes to use from its parents. The usage of the pipes allows processes to communicate with each other using an abstraction layer, removing from the processes its need of effectively being aware of the existence of each other, instead, they need only to rely on the file descriptors provided by the pipes.

A considerable part of the paper is dedicated to the shell interface. The authors present the way it works, where programs executed by users in the shell are searched inside the /bin folder, where every program needs to contain its own special file to be successfully executed. Multitasking is possible in the shell allowing users to execute multiple processes simultaneously by using the & symbol. Whenever UNIX receives the & symbol in the shell, instead of performing a wait system call, it executes a fork, making the processes to start at the same time instead of causing the shell to wait for the process to finish and then return no its init process. The shell itself is presented as being an independent and common process, like any other it can be executed by other programs creating thus, a flexible and extensible way of combining program executions. When the shell process is started, some verifications are made by the OS to see which user is using the shell and some other verification steps called “loggin in”. At the time, as presented by the authors it was already possible for users to update this initial process to start other programs instead of the interactive shell, a very useful feature for end users.

At the end, the authors highlight some facts that helped a lot the UNIX to suceed as an operating system: the fact that Thompson initialy developed it without a specifc porpose, he just wanted to solve some problems existing in previous systems. Also, being the UNIX creators programers, they focused a lot on making the system programmable and flexible being as simple as possible. An example of its simplificy can be found on the special files strategy implemented, making super clean and simple for programs to interact with UNIX devices. Admitting that UNIX suffered a lot of incluences from other operating systems such as Multics and TENEX, the authors presents the statistics of the UNIX usage from 72 users, where the system was able to run without any crash for nearly 2 weeks manipulating 300 folders and 4400 files, being the experiment runned for 356 days.