2009-07-19

What's the book about?

The obvious question is, what's the book about? Below are extracts from the current draft of the preface (which could well change in the next few months).



This book describes the Linux API (application programming interface)—the system calls, library functions, and other low-level interfaces provided by Linux, a widely used free implementation of the long-established Unix operating system. These interfaces are used, directly or indirectly, by every program that runs on Linux. Programs that explicitly use these interfaces are commonly called system programs, and include applications such as shells, editors, windowing systems, terminal emulators, file managers, compilers, database management systems, virtual machines, network servers, and much other software that is employed on a daily basis on Linux systems. The book is written to be used both as an introductory guide for readers new to the topic of system programming, and as a comprehensive reference for experienced system programmers.

We describe most Linux system calls, along with many related C library functions (as implemented in the GNU C library, glibc). These interfaces allow programs to perform tasks such as: low-level file I/O; creation of new processes and execution of programs; retrieval and modification of process attributes; communication and synchronization between processes and threads on the same host (computer); and communication between processes residing on different hosts connected via a TCP/IP network. We usually illustrate the use of each interface with a small program.

Although this book focuses on Linux, it gives careful attention to standards and portability issues, and clearly indicates those parts of the discussion that refer to Linux-specific details. As such, the book also provides a comprehensive description of the Unix/POSIX API and thus can be used by programmers writing applications targeted at other Unix systems or intended to be portable across multiple systems.

Intended audience and background required

This book is primarily aimed at the following readers:
  • programmers and software designers building applications for Linux, other Unix systems, or other POSIX-conformant systems;
  • programmers porting applications between Linux and other Unix implementations or between Linux and other operating systems;
  • teachers and advanced students teaching or learning Linux or Unix system programming; and
  • anyone (e.g., system managers and "power users") wishing to gain a greater understanding of the Linux/Unix API and of how various pieces of system software are implemented.
We assume that the reader has some prior programming experience, although not necessarily on a Linux or Unix system. No previous system programming experience is required. It is assumed that the reader has a reading knowledge of C and knows how to use the shell and common Linux or Unix commands. For readers coming to this book from other operating systems, a programmer-oriented review of fundamental concepts of Linux/Unix systems is provided in Chapter 2.

Standards and portability

Although this book describes the features of a specific Unix implementation, we take special care to consider portability issues. Frequent reference is made to relevant standards, in particular, the combined POSIX.1-2001 and Single UNIX Specification version 3 (SUSv3) standard; we also note changes in the recent revision of that standard, the combined POSIX.1-2008 and SUSv4. For features that are not standardized, we try to indicate the range of differences on other Unix implementations. We also highlight those major features of Linux that are implementation-specific, as well as pointing out various minor differences between the implementation of system calls and library functions on Linux versus other Unix implementations. (Conversely, where we do not indicate a feature as being Linux-specific, the reader can normally assume that it is a standard feature that appears on most or all Unix implementations.)

Linux and Unix

This book could have been purely about Unix system programming: most features found on other Unix implementations are also present on Linux, and vice versa. However, while emphasizing that writing portable applications is an important goal, I have chosen to also cover a range of Linux-specific extensions to the standard Unix API. The rationale for this approach is as follows:
  • The use of nonstandard extensions is sometimes essential, either for performance reasons, or to access functionality that is unavailable in the standard Unix API. (All Unix implementations provide nonstandard extensions for these reasons.)
  • I chose to focus on Linux because it is the implementation that I find to be the most important and interesting for a combination of reasons including its openness, licensing model, development model, and steadily increasing market share. (Ultimately, these reasons led me to become an active participant in Linux development.)
So, while this book is designed to be useful for programmers on all Unix implementations, it also provides full coverage of programming features specific to Linux. These features include: epoll, a mechanism for obtaining notification of file I/O events; inotify, a mechanism for monitoring changes in files and directories; capabilities; extended attributes; the clone() system call; the /proc file system; the timerfd API; and Linux-specific details of the signals, threads, shared libraries, and sockets implementations.

Usage and organization

This book is written to be used in two ways:
  • As a tutorial introduction to the Linux/Unix API. The book can (if you have a lot of time) be read linearly: later chapters build on material presented in earlier chapters, with forward references minimized as far as possible.
  • As a comprehensive reference to the Linux/Unix API, for use by experienced Linux and Unix programmers. An extensive index and heavy use of cross-referencing allow topics to be read in random order.
I’ll say more about the logical structure and contents of the book in my next post.

2 comments:

  1. Very much needed.. Waiting to get my copy.. Should ask my employer to get some for the office library

    ReplyDelete
  2. I have to say...I am going to buy this book not only because it will be a great resource, but because you dedicate your time to something not many soul's would even touch. Good Job, thanks and keep up the great work!

    ReplyDelete