This is an HTML rendering of a working paper draft that led to a publication. The publication should always be cited in preference to this draft using the following reference:
Athens University of Economics and Business
Kay A. Robbins and Steven Robbins
UNIX Systems Programming: Communication, Concurrency, and Threads
Prentice Hall PTR, Upper Saddle River, NJ, 2003
Systems programming is a challenging, unforgiving, educating, and rewarding activity. Programs that intimately interact with the underlying operating system for providing infrastructure services have to be extremely reliable, efficient in their use of the resources they handle, as well as secure and resilient against malicious attacks. Errors made at system program level can propagate to end-user application programs and can lead to data corruption, compromised systems, or unresponsive systems in millions of installations. On the other hand, writing a robust and useful systems application can be a source of satisfaction and pride that only a systems programmer can describe.
The book "UNIX Systems Programming" is an updated edition of a volume originally titled "Practical Unix Programming". It aims, and mostly succeeds, in making the art of systems programming in the Unix environment (and this includes flavors of open source POSIX systems such as Linux and FreeBSD) accessible to any reasonably skilled programmer. On top of that, the book doubles as an operating systems textbook, presenting many important concepts from a practical point of view.
The text is divided into four parts. The first part covers fundamental concepts like programs, processes, input/output, directories, and special files. The next two parts deal with asynchronous events and thread-based concurrency. The last part covers communication using the Internet protocols. All examples presented in the book are based on the most recent versions of the POSIX standards and the C language, down to the use of the new "restricted" keyword in function prototypes. The POSIX effort commendably standardizes an area of practice where conflicting implementations and gratuitous differences by Unix offerings of different manufacturers have caused programmers untold grief. However, as is typically case in the results of standardization efforts, the standard's prose can be difficult to comprehend. The authors have invested considerable effort into making the standard accessible to their readers by disentangling the various POSIX extensions and presenting the standard in the form of an (idealized) running operating system. Existing systems are slowly converging to this ideal, so readers will increasingly face a Unix system that matches the book's description irrespective of their system's roots. In fact, the book's numerous examples were tested on Solaris 9, RedHat Linux 8, and the (FreeBSD derived) Max OS 10.2.
The writing style is clear and often errs on the side of explaining concepts in too much detail, rather than too little. The authors have adopted a style where exercises with answers are sprinkled throughout the text. This literaly device may appear strange on the first encounter, but actually proves to be quite effective in bringing into life a subject that can sometimes be dry. In addition, two pedagogical elements of the book stand out: the combined presentation of theoretical concepts (e.g. deadlocks) within the context of the relevant library facilities (e.g. thread synchronization primitives) and the numerous practical complete projects that appear in the book. These include the implementation of a token ring of communicating processes, a library of virtual timers, a shell, a threaded print server, a parallel virtual machine, a web redirector, an Internet radio system, and a server performance characterization suite.
Could the book be improved? In many places the reader will encounter detailed descriptions of numerous different operating-system facilities and low-level directions for using applying them, but will not find prescriptive guidance on the context in which the facilities are useful. In other places too much emphasis is placed on the underlying API and less on concrete problems that systems programmers would want to solve. On the whole however, the book's presentation is outstanding, the diagrams are clear, and the code samples carefully written. A list of 137 references and a detailed index complete a book that will probably be treasured by a new generation of systems programmers.