Advanced Unix Programming Paperback – Jan 1987
No Kindle device required. Download one of the Free Kindle apps to start reading Kindle books on your smartphone, tablet, and computer.
To get the free app, enter your e-mail address or mobile phone number.
From the Publisher
A comprehensive examination of UNIX® system calls--the interface between user programs and the kernel.
From the Inside Flap
This book updates the 1985 edition of Advanced UNIX Programming to cover a few changes that have occurred in the last eighteen years. Well, maybe "few" isn't the right word! And "updates" isn't right either. Indeed, aside from a sentence here and there, this book is all new. The first edition included about 70 system calls; this one includes about 300. And none of the UNIX standards and imple-mentations discussed in this book--POSIX, Solaris, Linux, FreeBSD, and Darwin (Mac OS X)--were even around in 1985. A few sentences from the 1985 Preface, however, are among those that I can leave almost unchanged:The subject of this book is UNIX system calls--the interface between the UNIX kernel and the user programs that run on top of it. Those who interact only with commands, like the shell, text editors, and other application programs, may have little need to know much about system calls, but a thorough knowledge of them is essential for UNIX programmers. System calls are the only way to access kernel facilities such as the file system, the multitasking mechanisms, and the interprocess communication primitives.
System calls define what UNIX is. Everything else--subroutines and commands--is built on this foundation. While the novelty of many of these higher-level programs has been responsi-ble for much of UNIX's renown, they could as well have been programmed on any modern operating system. When one describes UNIX as elegant, simple, efficient, reliable, and porta-ble, one is referring not to the commands (some of which are none of these things), but to the kernel.That's all still true, except that, regrettably, the programming interface to the ker-nel is no longer elegant or simple. In fact, because UNIX development has splintered into many directions over the last couple of decades, and because the principal standards organization, The Open Group, sweeps up almost everything that's out there (1108 functions altogether), the interface is clumsy, inconsistent, redundant, error-prone, and confusing. But it's still efficient, reliably imple-mented, and portable, and that's why UNIX and UNIX-like systems are so successful. Indeed, the UNIX system-call interface is the only widely imple-mented portable one we have and are likely to have in our lifetime.
To sort things out, it's not enough to have complete documentation, just as the Yellow Pages isn't enough to find a good restaurant or hotel. You need a guide that tells you what's good and bad, not just what exists. That's the purpose of this book, and why it's different from most other UNIX programming books. I tell you not only how to use the system calls, but also which ones to stay away from because they're unnecessary, obsolete, improperly implemented, or just plain poorly designed.
Here's how I decided what to include in this book: I started with the 1108 func-tions defined in Version 3 of the Single UNIX Specification and eliminated about 590 Standard C and other library functions that aren't at the kernel-interface level, about 90 POSIX Threads functions (keeping a dozen of the most important), about 25 accounting and logging functions, about 50 tracing functions, about 15 obscure and obsolete functions, and about 40 functions for scheduling and other things that didn't seem to be generally useful. That left exactly 307 for this book. (See Appendix D for a list.) Not that the 307 are all good--some of them are use-less, or even dangerous. But those 307 are the ones you need to know.
This book doesn't cover kernel implementation (other than some basics), writing device drivers, C programming (except indirectly), UNIX commands (shell, vi, emacs, etc.), or system administration.
There are nine chapters: Fundamental Concepts, Basic File I/O, Advanced File I/O, Terminal I/O, Processes and Threads, Basic Interprocess Communication, Advanced Interprocess Communication, Networking and Sockets, and Signals and Timers. Read all of Chapter 1, but then feel free to skip around. There are lots of cross-references to keep you from getting lost.
Like the first edition, this new book includes thousands of lines of example code, most of which are from realistic, if simplified, applications such as a shell, a full- screen menu system, a Web server, and a real-time output recorder. The examples are all in C, but I've provided interfaces in Appendices B and C so you can pro-gram in C++, Java, or Jython (a variant of Python) if you like.
The text and example code are just resources; you really learn UNIX program-ming by doing it. To give you something to do, I've included exercises at the end of each chapter. They range in difficulty from questions that can be answered in a few sentences to simple programming problems to semester-long projects.I used four UNIX systems for nuts-and-bolts research and to test the examples: Solaris 8, SuSE Linux 8 (2.4 kernel), FreeBSD 4.6, and Darwin (the Mac OS X kernel) 6.8. I kept the source on the FreeBSD system, mounted on the others with NFS or Samba.
I edited the code with TextPad on a Windows system and accessed the four test systems with Telnet or SSH (PuTTY) or with the X Window System (XFree86 and Cygwin). Having the text editor and the four Telnet/SSH/Xterm windows open on the same screen turned out to be incredibly convenient, because it takes only a few minutes to write some code and check it out on the four systems. In*addition, I usually had one browser window open to the Single UNIX Specifi-cation and one to Google, and another window running Microsoft Word for editing the book. With the exception of Word, which is terrible for big documents like books (crashes, mixed-up styles, weak cross-referencing, flakey document- assembly), all of these tools worked great. I used Perl and Python for various things like extracting code samples and maintaining the database of system calls.--This text refers to an alternate Paperback edition. See all Product Description
Top Customer Reviews
There is a saying which goes, "UNIX is user-friendly; it's just picky about who its friends are." Upon reading Advanced UNIX Programming, I get the impression that Marc Rochkind may at one time have been a close friend of UNIX, but having become a little disillusioned by what UNIX has become in the 19 years since his first edition, is willing to settle for being a calm, professional acquaintance. His opening chapter provides two main reasons why this has happened: first, the UNIX kernel has grown from providing 70 or so system calls, to over 600 for an implementation that provides Single UNIX Specification and POSIX compliance; and second, there are so many flavours of UNIX out there (including Linux) that none of them implement exactly the same set of system calls. Thus the increasing complexity and diversity of UNIX implementations makes it difficult to know all that can be called UNIX intimately. Rochkind's book presents enough material to make the reader an acquaintance, leaving the building of a friendship as an exercise for the highly committed.
Rochkind makes a careful selection of just over 300 of the most important system calls and groups them into a handful of broad topics: I/O (file and terminal), processes and threads, inter-process communication (including sockets), signals, and timers. He takes great care to highlight what is available in Solaris (version 8), Linux (SuSE 8), BSD (FreeBSD 4.6), and Darwin (6.8; MacOS 10.2.8), and how to write something that has a hope of running on all of them. The system calls he describes are the ones anyone writing UNIX applications must know about. That is his target audience, and he meets that target squarely.Read more ›
What is different? Much. Indeed, most of the book. In the first chapter, he summarises myriad developments in the unix world and, of course, the rise of linux. He writes for all the current unix variations and linux.
Since 1985, there has been a plethora of different interprocess communications methods. So the chapters on these form a prominent part of the book. Then, naturally, in the networking chapter, who can ignore the web? So Rochkind gives a concise detour into http, with example code for a simple browser and web server.
One thing unchanged from the first edition is the well deserved use of "Advanced" in the title. The treatment is sophisticated and, frankly, not an easy read for someone new to the subject. Rochkind writes well, but you do have to concentrate. He goes at a pace that at a very minimum assumes you are already facile in C and with using unix at the user level. The source code examples are simple, once you grasp the concepts.
The problems he furnishes in each chapter can be extremely useful if you want to deepen your understanding. The questions are nontrivial and usually expand on salient points discussed in the chapters. If you are indeed new to all this, you should make a serious attempt at the problems.
Kernighan's book is ideal for Unix beginner's and offers a friendly general introduction to Unix programming and also covers shell programming very well. Rochkind's book details the basic Unix system calls and libraries.
I think that this book is still valuable and can be used as a fast course about old-style Unix programming. The best book on this subject is "Advanced Programming in Unix Environment" by Richard Stevens, that is well written, updated and covers much more topics, but takes a lot of time to read.
My favorite part is when Rochkind comments the source code of a mini-shell that can help you understand the mechanism of a real Unix shell.
But notice, Unix Network Programming isn't covered here.
Most recent customer reviews
I also have the first edition (and a previous book) and am an unabashed fan of Marc Rochkind's.
What this book promises and delivers is a catalog and explanation of Unix... Read more
The reviews posted under this title refer to the first edition of this book.
This is the long awaited and updated second edition which isn't even in the stores yet! Read more
One of the two most useful books on unix (another one is "The Unix Programming Environment").Published on Sept. 16 1999 by Does Not Matter
A very rare book with useful information about unix system calls, helps you acquire indepth knowledge about interprocess communication and unix file management system. Read morePublished on March 20 1999
An excellent book for people who want to understand and program under UNIX operating system. The author has done a wonderful job by building a set of library routines for... Read morePublished on Dec 28 1998 by firstname.lastname@example.org
Look for similar items by category
- Books > Computers & Technology > History & Culture > History
- Books > Computers & Technology > Operating Systems > Unix
- Books > Computers & Technology > Programming > APIs & Operating Environments > Unix
- Books > Computers & Technology > Programming > Languages & Tools
- Books > Education & Reference > Schools & Teaching
- Books > Politics & Social Sciences > Philosophy