Multithreaded Programming With PThreads
Bil Lewis | Daniel J. Berg | Sun Microsystems Press


Compras Nikon
Bluetooth
Multithreading lets programs do two or more tasks at once, and it can let programmers take advantage of the latest symmetric multiprocessor (SMP) systems in Unix. But to get this performance boost, you'll want to read Multithreaded Programming with Pthreads first. It delivers both the concepts behind multithreaded design along with real-world source code excerpts that show you how to apply the concepts to real-world Unix projects.

This book begins with the evolution of the various libraries that support multithreading. In the ecumenical spirit of Unix, the authors cover all the bases of Portable Operating System Interface for Unix (POSIX) libraries, including Linux, DEC, IBM, HP, and Sun Solaris, and even add-ons to NT and OS/2 for their POSIX support. The authors acknowledge that there may be variations in your version of Unix, but suggest that POSIX threads have good support from most vendors.

The authors then cover the basics of threads and how they run in today's Unix. The authors turn quickly to their implementation in variants of Unix, including Lightweight Processes (LWPs). They then cover the lifecycles of threads and how they are scheduled.

The primary focus in Multithreaded Programming with Pthreads is on how to make threads work together effectively. Multithreading involves a host of design issues, from patterns of how to organize threading in a program (with models such as the Producer/Consumer or the Master/Slave) to how to coordinate work done by multiple threads with facilities such as mutexes, critical sections, semaphores, and more arcane solutions (such as monitors and spin locks). The authors guide the reader to all the possibilities here, including suggestions on program design.

The real-world focus here involves some sample code (in C), a quick tour of the issues in using Pthreads with other programming languages, and some excellent material on benchmarking multithreaded code. The authors' ideas on when to use and when to avoid Pthreads are also useful. Though Pthreads will not work everywhere, they have a lot of potential to enhance the performance of today's software. This technical--and quite engaging--text can show you if Pthreads are in the cards for your next Unix programming project.


1 User of Sun Equipment, writer of parallel software.
As technical books go, this is the second worst book I've ever personally bought - and I have five book cases full of books (mostly technical ones).

The book covers far too much material, in far too small a depth, to be of any use to anyone. Since it's published by Sun Microsystems, whose main operating system is Solaris, I thought there might be a decent coverage of threads on Solaris, with less devoted to NT, Dec and whoever elses. But no, there is as much coverage on Solaris threads, as there is on any other. You could say it's a balanced coverage, but at such a depth to be useless to anyone really. If you need to know about threads on Windows, find a specific book. If you need to know about pthreads, find a better book on pthreads.

Just avoid this book. However Sun Microsystems, a respected producer of hardware and some excellent technical books, published such rubbish I don't know.

Do youself a favor, take a look at 'Multithreaded, Parallel and Distributed Programming' by Gregory R. Andrews. That is a good book on parallel programming, with an indepth discussion about algorithms, and code to implement them in threads, openMP and MPI. It's coverage of algorithms, barriers, locks etc is excellent.


2 Wonderful!
The authors of this book, in addition to their knowledge of threads, also know how to teach. The only shortcoming I could point out is that certain topics are treated shallowly, while less important topics are explained with too much detail.

What's really interesting about the book is the authors' ``don't do that'' style. Another reviewer found this style to be bad. I found it highly helpful. Instead of presenting a single solution for a problem (``The One and Only True Solution''), and leaving the reader wondering about alternative solutions, they go on to explain what's wrong with these other solutions. People learn by making mistakes, and the authors point out lots of mistakes that can be avoided. This is an invaluable feature, not a bug.


3 Simply useless
If you have no clue what a pthread function name is, or what this crazy multithreading idea is all about, then maybe this book will help you some...but I have my doubts. Otherwise, this serves as both a poor reference, a poor primer guide, a poor advanced guide, and poor toilet paper. I've never seen a book manage to miss as a reference, miss as a primer, and miss as an advanced guide. There are easily better books and online resources available, as it's hard to be much worse than this.

This book is akin to learning French by teaching some basic grammar, some advanced grammar, and then shouting: "Je ne sais pas!" "Je voudrais un peu cherise!" without telling you what these mean...and leaving you clueless as to how to find out about them.


4 No as good as It looks like.
This Book covers too many topics unnecessarily, so when you really want to go a little deep into a specific field and make yourself clear, that will be not possible.
This book is not really suitable for real multi-threaded programmer.
New multi-threaded leaners maybe will found it useful for basic concepts.
5 Where is the source-code for download?
This book didn't supply source code for download neither attach CD-ROM. How can I verify whether it's true?
6 This book knocks the P out of Pthreads...
I primarily ordered this book to learn POSIX threading techniques for Unix. Imagine my surprise when the book delved again and again into excessive detail on Win32 and OS/2 implementations of threads.

The book also spent every other paragraph covering problematic features of threads. If I were going to write a handbook for first time handgun owners, I wouldn't spend half the book explaining how you could take a live round, put it in the chamber, pull back the trigger, put the barrell in your mouth, and gently squeeze the trigger, oh by the way "Don't do that!" I would like to have seen a simple explanation of how to properly use threads for several different cases, and let natural selection determine if I was stupid enough to try some of the extreme cases that the book covers in detail.

Perhaps if the Win32, OS/2, and problematic features of threads had been separated out into late chapters, the book would have been readable. As the book is written, I found it hard to maintain a continuous stream of thought with the authors constantly bleating, Touret-like, "You can do this. BUT DON'T DO THAT! And here's how you can do the same thing for Win32. BUT DON'T DO THAT!" The confusing graphic illustrations and lack of substantial code examples concurrent with the topic at hand did not serve to make my reading any easier.

I also did not appreciate the authors' flippant dismissal of real time programming. To paraphrase the book, "We don't know real time, so tough cookie."

Overall, the book was a decent threads primer with good information scattered throughout.


7 Very good book on Pthreads
This book has all of the information from the "Threads Primer" book and more. It covers the topic very well and if this was the only book you read you'd be fine. I like the Butenhof threads book just a bit better because the programming examples there were much better than the small code fragments presented in this book.

Thursday, 08-Jan-2009 17:39:50 CST
Quote of the Day:


The first rule of all intelligent tinkering is to keep all the parts.

-- Aldo Leopold, quoted in Donald Wurster's "Nature's Economy"

"Boy, life takes a long time to live."
-- Steven Wright