Advanced Search
Start Your Free Trial

Overview

Other Readers Also Read...

Top Sellers in this Category

Algorithms in a Nutshell

Algorithms in a Nutshell
by George T. Heineman; Gary Pollice; Stanley Selkow

Learn C on the Mac

Learn C on the Mac
by Dave Mark

Regular Expressions Cookbook

Regular Expressions Cookbook
by Jan Goyvaerts; Steven Levithan

With this practical book, you will attain a solid understanding of threads and will discover how to put this powerful mode of programming to work in real-world applications.

The primary advantage of threaded programming is that it enables your applications to accomplish more than one task at the same time by using the number-crunching power of multiprocessor parallelism and by automatically exploiting I/O concurrency in your code, even on a single processor machine. The result: applications that are faster, more responsive to users, and often easier to maintain. Threaded programming is particularly well suited to network programming where it helps alleviate the bottleneck of slow network I/O.

This book offers an in-depth description of the IEEE operating system interface standard, POSIXAE (Portable Operating System Interface) threads, commonly called Pthreads. Written for experienced C programmers, but assuming no previous knowledge of threads, the book explains basic concepts such as asynchronous programming, the lifecycle of a thread, and synchronization. You then move to more advanced topics such as attributes objects, thread-specific data, and realtime scheduling. An entire chapter is devoted to "real code," with a look at barriers, read/write locks, the work queue manager, and how to utilize existing libraries. In addition, the book tackles one of the thorniest problems faced by thread programmers-debugging-with valuable suggestions on how to avoid code errors and performance problems from the outset.

Numerous annotated examples are used to illustrate real-world concepts. A Pthreads mini-reference and a look at future standardization are also included.

Amazon.com® Reader Reviews (Ranked by Helpfulness)

Average Amazon.com® Rating: 4.5 out of 5 rating Based on 24 Ratings

Remember the rules - 2009-05-09
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book is very clearly written, with easy to understand examples and rules. One can immediately apply the skills presented in the book into practice. I learned something new like "memory visibility" between thread and "thread inertia".

Another merit of the book is its size, not too short or too long.

In a nutshell, the key for threaded programming is to recognize the data needs to be protected, and the key to debug is to recognize which problems you may be encountering.

I am not a big fan of Lewis Carroll, so basically I just ignored all the good quotings.

A 'need to have' for experts and non-expers - 2008-01-07
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I first read the book about 6 years ago (2003) when on my MSc studies. A friend lent me the book to read as a basic introduction for thread programming. At that time I was doing projects in Java only, but surprisingly it was so easy to understand Java thread model by reading the book with code samples in C.

Two years later, I stayed on PhD studies at the University. Once again I needed to do some parallel processing project. I ordered the book through my library. Once again it became handy. But it still wasn't on my bookshelf - I had to go to the library to have it.

This year I said to myself: 'No. If you needed this book so many time, you got to have it on your bookshelf'. So there you go - I bought it as a gift for myself for Christmas 2007.

The best book on the topic - 2007-10-25
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
In my opinion, this book is better than Pthreads Programming: A POSIX Standard for Better Multiprocessing (O'Reilly Nutshell) because it goes way beyond just presenting the pthreads API. One critic I had on all the other multithreading books that I have read is that they are not covering issues with multithread programs on a SMP system. This book is actually discussing some of these issues on several pages! Beside this quality, it also covers high-level design patterns on how you can use threads such as pipelines, work crew and client/server. There is also a chapter showing how to program with thread cancellation and a section explaining how to create new synchronization objects from the primitives. This brings me to the only problem that I can think of this book: its age. It is not totally up to date. Learning how you can build new synchronization objects by itself is a very interesting exercise but the problem is that the new synchronization objects built are the barrier and the read/write lock which have been added to the pthreads API since the book publication. Also, except for a small section describing the futur of pthreads, the newest additions to the pthread API are not described.

Excellent book with practical advice for software developers - 2007-07-27
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I've been using this book as a reference for Pthread programming for the past 2 years. The thing that strikes me most about this book is that it *always* has the answers to my questions, and those answers are always easy to find.

A couple of examples. I was thinking to myself "Wow, if the thread was to be cancelled while these set of operations were executing, things would be very broken. How do I make sure these operations get executed in full?"

So, I went to the index and looked up 'Cancellation', under which there was 'deferred', which pointed me to pages 147-150. Right on the top of page 147 it says "A thread can disable cancellation around sections of code that need to complete without interruption, by calling pthread_setcancelstate." It then goes on to give examples. I thought to myself "That was easy!"

Another example, I wanted to know how to protect a local static variable from multiple simultaneous initialization. I looked up 'Initialization' in the index, which pointed me to pages 131-134. Sure enough, on page 132 it says "If more than one thread executes the initialization sequence concurrently, two threads may both find 'initializer' to be 0, and both perform the initialization, which, presumably, should have performed only once. The state of initialization is a shared invariant that must be protected by a mutex. You can code your own one-time initialization using a boolean variable and a statically initialized mutex. In many cases this will be more convenient than pthread_once, and it will always be more efficient."

Wow, another clearly explained answer to my question. I could give another example regarding how to properly use condition variables and avoid subtle race conditions, but suffice it to say the answer was easily located and clearly explained. If only more books were this accessible!

Is this book suitable for an expert Pthreads programmer? I don't know; I'm not that person. What I do know is that I have to write Pthreads code that is correct and reliable, and this book gives me the advice I need to make that happen.

Mr. Butenhof, could you please write more books on POSIX programming?

Exceptional - 2008-11-07
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I have used pthreads pretty extensively. If there is any book close to being called bible,this is it. Go get it.

Browse Similar Topics

Top Level Categories:
Programming

Sub-Categories:
Programming > C

Some information on this page was provided using data from Amazon.com®. View at Amazon >


About Safari Books Online • Terms of Service • Privacy Policy • Contact Us • Corporate Licenses • Help • Accessibility | See us on FacebookSee us on Linked InSee us on TwitterRSS

Copyright 2009 Safari Books Online. All rights reserved.