• Twitter
  • FaceBook

Security Forums

Log in

FAQ | Search | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

Book Review - Advanced Programming In The UNIX Environment

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> News // Columns // Articles

View previous topic :: View next topic  
Author Message
Trusted SF Member
Trusted SF Member

Joined: 26 Aug 2003
Posts: 31
Location: Warwickshire, England, UK


PostPosted: Mon Sep 05, 2005 10:44 pm    Post subject: Book Review - Advanced Programming In The UNIX Environment Reply with quote

Advanced Programming In The UNIX Environment, Second Edition

Author(s): W. Richard Stevens, Stephen A. Rago
Publisher: Addison-Wesley http://www.awprofessional.com
Date Published: June 2005
Book Specifications: Hardcover, 927 pages
Category: UNIX/Linux Programming
Publisher's Suggested User Level: None
Reviewer's Recommended User Level: All UNIX Programmers
Suggested Publisher Price: $74.99 US / $104.99 CAN
ISBN: 0-201-43307-9
Amazon.com: http://www.amazon.com/exec/obidos/ASIN/0201433079/securitforums-20/
Amazon.co.uk: http://www.amazon.co.uk/exec/obidos/ASIN/0201433079/securityforum-21/

Info from back cover:
For over a decade, serious C programmers have relied on one book for practical, in-depth knowledge of the programming interfaces that drive the UNIX and Linux kernels: W. Richard Stevens' Advanced Programming In The UNIX Environment. Now, Stevens' colleague Stephen Rago has thoroughly updated this classic to reflect the latest technical advances and add support for today's leading UNIX and Linux platforms.

Rago carefully retains the spirit and approach that made this book a classic. Building on Stevens' work, he begins with basic topics such as files, directories, and processes, carefully laying the groundwork for understanding more advanced techniques such as signal handling and terminal I/O.

Substantial new material includes chapters on threads and multithreaded programming, using the socket interface to drive interprocess communication (IPC), and extensive coverage of the interfaces added to the latest version of the POSIX.1 standard. Nearly all examples have been tested on four of today's most widely used UNIX/Linux platforms: FreeBSD 5.2.1; the Linux 2.4.22 kernel; Solaris 9; and Darwin 7.4.0, the FreeBSD/mach hybrid underlying Apple's OS X 10.3.

I first heard about APUE (Advanced Programming In The UNIX Environment) in a discussion on IRC. At the time, I looked at its Amazon webpage and decided that the book was far too expensive; that nothing could be worth that much.

A year later, after battling through many UNIX programming tasks, I saw a copy of the first edition of APUE in a bookshop and decided to look through it. I realised instantly why this book is so highly regarded by UNIX programmers worldwide, and bought a copy right away.

Now, with the publication of the second edition, I have the privilege of reviewing this essential programmers reference.

This second edition expands on the content of the first edition and updates it for the modern UNIX environment. Discussions of Linux and BSD are included, as well as the threading and sockets topics absent from the first edition. In addition, the final chapters from the first edition, examples of C applications using the information from the rest of the book, have been updated to tie in more closely with modern systems. The chapter covering communicating with a network printer, for example, now uses IPP (Internet Printing Protocol) and HTTP.

Chapter Synopsis & Review Comments
Chapters 1 and 2 introduce the UNIX system and standards. Chapter 1 talks about the architecture of UNIX, files and directories, input and output, processes, signals and system calls, while chapter 2 looks at the standards behind UNIX; POSIX, the Single UNIX Specification, FIPS standards, and the ISO C Standard. This chapter also looks at the variants of UNIX in common use in the modern world, including BSD and Linux.

Chapter 3 discusses file I/O in detail, covering every file I/O related system call. Each function is discussed in detail within its own section of the chapter, and tables and code illustrate the concepts discussed.

Chapter 4 covers files and directories, the stat function, file types and many other file and directory related functions, while chapter 5 looks at the standard I/O library, FILE objects, buffering and repositioning I/O streams.

System data files are the topic of chapter 6, which looks at the password and shadow files, group file and covers topics such as login accounting and system identification.

Chater 7 covers the process environment in UNIX, looking at the environment list, command-line arguments, memory layout of a C program and shared libraries, while chapter 8 discusses process control, including the fork and exec functions responsible for spawning new processes.

Chapter 9 is a look at the relationships between processes in UNIX, covering process groups, sessions, controlling terminals and job control.

In chapter 10, the discussion moves to signals, the mechanism by which the kernel (or another program) can report status to a running program and interrupt its flow of control with the use of signal handlers. This chapter covers all the UNIX signals and related functions.

Chapters 11 and 12 are new to the second edition of APUE, and cover threading. Threads allow parallel flow of control within a program, and these chapters cover creating and using threads in chapter 11, and controlling threads in chapter 12.

The (relatively short) chapter 13 discusses daemon processes. These are processes, often servers, without a controlling terminal, running in the background. This chapter discusses the procedure which must be followed to create a daemon process and ensure that it is detached from its controlling terminal and any filesystem resources it does not need.

Advanced I/O is the topic of chapter 14, with a look at nonblocking I/O, which does not cause the program to wait for input if none is available when a read request is encountered, I/O multiplexing and asynchronous I/O.

Chapters 15, 16 and 17 cover IPC (Interprocess Communication). Chapter 15 introduces IPC using pipes, FIFOs (named pipes) and other IPC constructs such as message queues. Network IPC is discussed in chapter 16, looking at the UNIX sockets interface, while chapter 17 looks at advanced IPC using STREAMS-based pipes, UNIX Domain Sockets or passing file descriptors between processes.

Terminal I/O is covered in chapter 18, while chapter 19 looks at pseudo-terminals.

A database library is presented in chapter 20, using concepts from the rest of the book in a real-world example, and chapter 21 provides another example with a look at communicating via IPP (Internet Printing Protocol) and HTTP (HyperText Transfer Protocol) with a network PostScript printer.

The book contains three appendices. Appendix A contains a list of function prototypes for every UNIX system function, appendix B contains miscellaneous source code from the book, including a header file referenced throughout, and appendix C gives the solutions to selected exercises presented in the book.

A bibliography and index round off this UNIX programming text.

Style and Detail
Rago manages to achieve seamless integration of his updates and additions with Stevens' original text, and maintains the feel of the original book. Each subtopic is presented in a section of the chapter covering the concept as a whole, and chapters end with a summary and exercise list.

There is a huge amount of information presented, but the comprehensive contents and index tables provide the easy access to the facts expected of a reference book, while the topics are presented in such a way that the book can be read tutorial-style, cover to cover.

A chapter on communicating with a serial modem, present in the first edition, was removed from this edition of APUE. The chapter is available on the book's website as it was deemed useful enough to keep around, but not useful enough to keep in-print. Personally, I feel it would have been more in-keeping with this book's status to retain that chapter, or to have included a discussion of USB communications or similar, in line with the modifications on the printing chapter.

The book covers the entire UNIX programming interface. For inexperienced programmers, this book works far better than the online UNIX manual pages, as it provides background and explanations for all of the concepts covered. For an advanced programmer, however, these explanations are less important, and the manual pages often provide faster access to the information you need. For the price, a lot is expected from this book, and, although I personally think it delivers, it is important to realise that a lot of the information presented can be found in the UNIX manual pages, albeit in a less comprehensive, easy to understand format.

I said in my introduction that I could see why the first edition of this book was so highly regarded amongst UNIX programmers. This second edition rises to the challenge of bettering the first edition, and succeeds, providing modernised coverage of UNIX.

To achieve a score of 10 in a review, I believe that a book must present the majority of its content in a format which is useful to everyone likely to read it. This book does exactly that, and is thus awarded the highest possible rating.

This book receives an honoured SFDC Rating of 10/10.

Keywords: UNIX, Programming, sockets, file, input, output, IPC, threads

This review is copyright 2005 by the author, Andrew J. Bennieston, and Security-Forums Dot Com, and may not be reproduced in any form in any media without the express permission of the author, or Security-Forums Dot Com.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> News // Columns // Articles All times are GMT + 2 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Community Area

Log in | Register