
Title: Pthreads Programming
A POSIX Standard for Better Multiprocessing
Authors: Bradford Nichols, Dick Buttlar, Jacqueline Proulx Farrell
Publisher: O'Reilly & Associates
Edition: First, September 1996
ISBN: 1-56592-115-1
Pthreads is an important international standard for multi-threaded programming, a method of achieving parallelism in computer programs. Threads are functions within a program, that are independently scheduled for execution by the operating system. Multi-threaded programs really excel when high-performance is required, especially when multiple I/O channels are necessary. Web servers and database servers are examples of programs that benefit from multi-threading.
The Pthreads (short for POSIX-threads) standard has remained virtually unchanged in the time since this book was published. This makes the book just as useful now as it was then. Likewise, the need for multi-threaded programs has not diminished.
This book is useful for anyone wanting a comprehensive understanding of how Pthreads work and an understanding of how to write multi-threaded software. The topic is probably best approached by experienced programmers, though talented beginners may be able to tackle it. At least several programming languages currently support multi-threading; C, Java and Python immediately come to mind. All the examples in the book are written in C. Threading in other languages can be implemented differently than in C. Because Pthreads library calls are the same in different languages (one reason programming standards exist) and because the book gives an excellent overall explanation of Pthreads concepts, the book can be useful even to those programming in other languages.
Pthreads Programming is 286 pages in length, fairly short compared to the massive tomes normally found in the computer book section. This is because the authors employ a concise, to-the-point, yet conversational writing style. I found the book very easy to read. The narrative flows as if you are listening to a friend in your living room. The book is well illustrated with sample source code and diagrams. The diagrams in particular are very well done. The code and diagrams are interlaced within the text in a manner that jumps between explanation and illustration, a very effective teaching technique that keeps the reader engaged with the subject. You will find yourself compiling the examples and creating your own, as you learn each facet of multi-threading. The authors provide comprehensive coverage of Pthreads, and threading in general, addressing all areas of the topic. One of the Appendixes is a "Pthreads Quick Reference," containing an alphabetical listing and synopsis of all Pthread library C bindings.
Multi-threading is useful for high-performance programs, but many programs can benefit from threading. There are programs that don't benefit from multi-threading, and in fact can actually perform slower when implemented with threads. The authors go into detail explaining these types of performance concepts, with the aid of charts displaying performance data from programs they have written.
Some of the source code in the book can be used as templates for your own programs. The program used to illustrate the "thread pool" model is the best example of this.
There are minor programming errors in some of the source code examples. I was able to overlook these, because the book is overall so well done. The errors are a bit irritating, but you can look at the positive side and see this as a way of keeping you alert.
I also found that a couple of concepts are not explained quite as thoroughly and clearly as they should be. Again, this is a minor complaint compared to the overall effort.
This book is one of the best, if not the best, computer science books I've ever read. I recommend it highly. It achieves the goal of teaching Pthreads concepts and programming techniques. I first read the book in 1997, and have benefited from it on a couple of development projects I've done for Fortune 500 clients; the programs I developed (basically multi-threaded Unix daemons) are still in operation and positively impacting the bottom line at those companies. It has been an invaluable title in my collection. When searching for a Pthreads book, I compared the several titles available and found this one clearly more effective than the others. I've been meaning to review this book for a while, but never had the time. Other reviewers panned the book for the source code errors; I never understood how they could overlook the book's overall excellence and condemn it for a few minor blemishes. It is interesting, how this book has stood the test of time, a testament to the power of well developed standards.
January 9, 2006
Copyright 2006 © Adrien Lamothe. All rights reserved.