Compras Nikon Bluetooth |
Butenhof is at his best when explaining the deep stuff and the subtle aspects of parallel programming. If this is what you need, the book is great. But if you want someone to show you how to use Pthreads and enable you to get up to speed quickly, then you will find this book rather frustrating.
The absence of downloadable code is an additional frustration. I'd go with the books by Bil Lewis, which are more straightforward and he offers tons of downloadable examples.
To whom English is a foreign language an author's writing style
and choice of expression is sometimes the most important detail.
This book about POSIX-threads is for me. I respect THE OTHER
author's achievment. Also, I do not know how much of the
contents is outdated in either publication...
So, this is not about the quality of each snippet of Code, but
about the _usefulness of a book_ to teach POSIX-threads
comfortably to a complete beginner on the subject.
Take a copy, read some paragraphs from different chapters and
get an impression, before you buy any book on POSIX threads.
This one would be my first choice. :-)
The book gives everything you need to start writing POSIX-style multithreaded applications. Very complicated (in my opinion) issues of multithreading are explained very clearly. Every new concept is immediately illustrated with a sample code.
The appendix contains a detailed description of all mentioned pthread functions, so you can use it as a reference too.
At the same time I am not sure if book is completely up-to-date. E.g., in chapter 7 the author explains in details what is a read/write lock and presents a code with a mutex and 2 condition variables to use as an r/w lock. In the appendix he says that r/w lock can be incorporated into POSIX as a separate entity in future. I work with Solaris 8 and I found that r/w locks are already in my POSIX library.
The style of book is quite special, you may love it, or you may hate it. Sometimes the very basic concepts are explained in such a way and with so repetitions that it becomes even a bit annoying. Those bailing programmers are also a bit annoying. Quotes from Lewis Carroll seem a bit off topic too. Of course it's just my opinion.
In general I think the book worth its money and recommend it to everyone interested in the subject.
Prerequisites are simple: knowledge of C and general POSIX. E.g., I recommend a book by Mr. Gallmeister on real-time (non-multithreading) POSIX.
The book delivers what you would expect from a book on POSIX threads, nothing more, nothing less.
- code examples are rather simplistic, with no attempt to show some real-life application
- Unlike Stevens, the author doesn't try to cover multiple UNIX implementations' specifics in a systematic manner (Stevens covered at least 6 flavors of UNIX!)
- Unlike Stevens, the author doesn't bother to show the results of running programs on multiple UNIX systems
- Typical threads programming mistakes are explained without showing any code. This is not the way I prefer it - I'd rather see a project spec, then an obvious (and wrong!) implementation with explanation of a mistake, then iterations of improvements up to a proper implementation
- The material definitely targets a VERY inexperienced person. The first half of the book is way too slow, especially compared to the 2nd half
- I found excerpts from Alice distracting and the pictures crude :-) . This is not what I expect to find in a technical book.
All in all, I don't like this book much - yet make no mistake - it will teach you how to program with pthreads. You won't enjoy the same sharp and intelligent style you'd get in UNPv1 (or on the opposite, you won't be so bored with technical details, if you don't like Stevens), but you will get the required information from it. After all, the author was part of the POSIX pthreads standardization group, so he knows what he is talking about.
PS. The UNPv1 book mentioned in this review is about NETWORK PROGRAMMING, not threads and it is in no way suggested as a replacement reading for the book reviewed.
Take 'mutexes' as an example. A useful explanation for a beginner might be as follows... (1) Where the word 'mutex' comes from (2) What a memory conflict is (3) How a mutex can avoid it (4) How it works (simplified) (5) Some good examples in programs
On page 6 we first meet a mutex in a bit about putchar - we turn 'putchar into a 'critical section' (unexplained) because 'putchar might lock a "putchar mutex" '.
Don't bother trying to understand it. Next paragraph, we find 'the correct solution is to associate the mutex with the stream', so it was a bad idea in the first place. Oh.
Two chapters later, on page 47, you get to know what a 'mutex' is. It's mutual exclusion using a special form of Edsger Dijkstra's semaphore, you dummy. Well, if you've read Edsger Dijkstra's 1968 paper, then you aren't likely to be reading this book, says I.
Confused? Keep going. Finally on page 90, there is a neat tabular description of one thread reading a variable before the other one has written it, and how you can stop this with a mutex. Clear and simple, this should have been on page 6. The following section (marked "You may want to skip this explanation...") then describes the sorts of problem you get with real hardware - surely a 'must read' if you are going to do this sort of stuff.
There is a noble tradition of giving a bad coding example in one chapter, so you can show how cleverly you can fix it in the next. Look at any Stroustrop book. I think this is a bad idea - every example of code ought to be as good as you can make it: someone might just lift the section from your code as it stands. Anyway, I wasted a lot of time pouring over a 3-page example program because I was convinced it did not work, only to find that the author knew it had a bug in it, but was keeping up the suspense to the next section.
While I'm on pet hates, if I wanted Lewis Carroll, I would have bought Lewis Carroll: we could loose the quotes. And the cartoons of "Three Men in a Boat". And the explanations of what the zero in the Unix clock means every time it is used.
Ooohhh, this book could be so much shorter, and sooo much better. Still, I have got my program going, and that's the main thing.
Chapter 8 ("How to Avoid Debugging") is a classic and provides sound advice; I often recommend this chapter to Windows programmers as the advice applies to all multithreaded systems, not just Pthreads. Numerous deadlocks, race conditions, and other all too common bugs can be avoided after a careful reading of this chapter.
The author is active in the comp.programming.threads discussion group, and his thorough and thoughtful responses, similar to the explanations in the book, have helped to clear up numerous misunderstandings.
The things that I like the most about this book are the clear cut explanation of POSIX functions coupled with 'working' compile-able examples. Throughout the book the author tells you how to avoid common mistakes and this is what makes it a really practical everyday kinda book.
I keep this book on my desk at all times. Perhaps, the best book on POSIX so far.
A great book for understanding multithreading concepts, for 'how to' examples, and for advice for avoiding the many pitfalls.
If you need to write portable, maintainable threads code that works, this book is a good place to start. I wish the person who wrote the code I now have to debug had read this book and followed Butenhof's teachings!
But, for learning about POSIX threads, this book is nice. Not too technical, not to 'POSIX for Dummies' either...
From the cradle to the coffin underwear comes first.
-- Bertolt Brecht
Truth never comes into the world but like a bastard, to the ignominy
of him that brought her birth.
-- Milton