or
Sign in to turn on 1-Click ordering.
 
 
Express Checkout with PayPhrase
What's this? | Create PayPhrase
More Buying Choices
38 used & new from $31.65

Have one to sell? Sell yours here
 
   
Programming with POSIX(R) Threads
 
 
Tell the Publisher!
I’d like to read this book on Kindle

Don’t have a Kindle? Get your Kindle here.
 
  

Programming with POSIX(R) Threads (Paperback)

~ (Author)
4.4 out of 5 stars  See all reviews (24 customer reviews)

List Price: $59.99
Price: $38.51 & this item ships for FREE with Super Saver Shipping. Details
You Save: $21.48 (36%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In Stock.
Ships from and sold by Amazon.com. Gift-wrap available.

Want it delivered Tuesday, December 22? Choose One-Day Shipping at checkout. Details
Ordering for Christmas? To ensure delivery by December 24, choose Standard Shipping at checkout. Read more about holiday shipping.

23 new from $35.74 15 used from $31.65

Frequently Bought Together

Programming with POSIX(R) Threads + Pthreads Programming: A POSIX Standard for Better Multiprocessing (O'Reilly Nutshell) + Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
Price For All Three: $103.51

Show availability and shipping details


Customers Who Bought This Item Also Bought

Pthreads Programming: A POSIX Standard for Better Multiprocessing (O'Reilly Nutshell)

Pthreads Programming: A POSIX Standard for Better Multiprocessing (O'Reilly Nutshell)

by Bradford Nichols
3.7 out of 5 stars (11)  $23.07
Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)

Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)

by Stephen A. Rago
4.9 out of 5 stars (14)  $41.93
Unix Network Programming, Volume 1: The Sockets Networking API (3rd Edition)

Unix Network Programming, Volume 1: The Sockets Networking API (3rd Edition)

by W. Richard Stevens
4.8 out of 5 stars (25)  $51.35
UNIX Systems Programming: Communication, Concurrency and Threads

UNIX Systems Programming: Communication, Concurrency and Threads

by Kay A. Robbins
4.4 out of 5 stars (25)  $62.36
UNIX Network Programming, Volume 2: Interprocess Communications (2nd Edition)

UNIX Network Programming, Volume 2: Interprocess Communications (2nd Edition)

by H. Richard Stevens
4.4 out of 5 stars (12)  $65.48
Explore similar items

Editorial Reviews

Product Description

Here is a programmer's guide to using and programming POSIX threads, commonly known as Pthreads. A "coder's book", this title tells how to use Pthreads in the real world, making efficient and portable applications. Pthreads are an important set of current tools programmers need to have in today's network-intensive climate.


From the Inside Flap

The White Rabbit put on his spectacles,
"Where shall I begin, please your Majesty?" he asked.
"Begin at the beginning," the King said, very gravely,
"and go on till you come to the end: then stop."
 ***-Lewis Carroll, Alice's Adventures in Wonderland

This book is about "threads" and how to use them. "Thread" is just a name for a basic software "thing" that can do work on a computer. A thread is smaller, faster, and more maneuverable than a traditional process. In fact, once threads have been added to an operating system, a "process" becomes just data--address space, files, and so forth--plus one or more threads that do something with all that data.

With threads, you can build applications that utilize system resources more efficiently, that are more friendly to users, that run blazingly fast on multiprocessors, and that may even be easier to maintain. To accomplish all this, you need only add some relatively simple function calls to your code, adjust to a new way of thinking about programming, and leap over a few yawning chasms. Reading this book carefully will, I hope, help you to accomplish all that without losing your sense of humor.

The threads model used in this book is commonly called "Pthreads," or "POSIX threads." Or, more formally (since you haven't yet been properly introduced), the POSIX 1003.1cn1995 standard. I'll give you a few other names later-but for now, "Pthreads" is all you need to worry about.

As I write this, Sun's Solaris, Digital's Digital UNIX, and SGI's IRIX already support Pthreads. The other major commercial UNIX operating systems will soon have Pthreads as well, maybe even by the time you read this, including IBM's AIX and Hewlett-Packard's HP-UX. Pthreads implementations are also available for Linux and other UNIX operating systems.

In the personal computer market, Microsoft's Win32 API (the primary programming interface to both Windows NT and Windows 95) supports threaded programming, as does IBM's OS/2. These threaded programming models are quite different from Pthreads, but the important first step toward using them productively is understanding concurrency, synchronization, and scheduling. The rest is (more or less) a matter of syntax and style, and an experienced thread programmer can adapt to any of these models.

The threaded model can be (and has been) applied with great success to a wide range of programming problems. Here are just a few:

Large scale, computationally intensive programs High-performance application programs and library code that can take advantage of multiprocessor systems Library code that can be used by threaded application programs Realtime application programs and library code Application programs and library code that perform I/O to slow external devices (such as networks and human beings). Intended audience

This book assumes that you are an experienced programmer, familiar with developing code for an operating system in "the UNIX family" using the ANSI C language. I have tried not to assume that you have any experience with threads or other forms of asynchronous programming. The Introduction chapter provides a general overview of the terms and concepts you'll need for the rest of the book. If you don't want to read the Introduction first, that's fine, but if you ever feel like you're "missing something" you might try skipping back to get introduced.

Along the way you'll find examples and simple analogies for everything. In the end I hope that you'll be able to continue comfortably threading along on your own. Have fun, and "happy threading."

About the author

I have been involved in the Pthreads standard since it began, although I stayed at home for the first few meetings. I was finally forced to spend a grueling week in the avalanche-proof concrete bunker at the base of Snowbird ski resort in Utah, watching hard-working standards representatives from around the world wax their skis. This was very distracting, because I had expected a standards meeting to be a formal and stuffy environment. As a result of this misunderstanding, I was forced to rent ski equipment instead of using my own.

After the Pthreads standard went into balloting, I worked on additional thread synchronization interfaces and multiprocessor issues with several POSIX working groups. I also helped to define the Aspen threads extensions, which were fast-tracked into X/Open XSH5.

I have worked at Digital Equipment Corporation for (mumble, mumble) years, in various locations throughout Massachusetts and New Hampshire. I was one of the creators of Digital's own threading architecture, and I designed (and implemented much of) the Pthreads interfaces on Digital UNIX 4.0. I have been helping people develop and debug threaded code for more than eight years.

My unofficial motto is "Better Living Through Concurrency." Threads are not sliced bread, but then, we're programmers, not bakers, so we do what we can.

Acknowledgments

This is the part where I write the stuff that I'd like to see printed, and that my friends and coworkers want to see. You probably don't care, and I promise not to be annoyed if you skip over it-nbut if you're curious, by all means read on.

No project such as this book can truly be accomplished by a single person, despite the fact that only one name appears on the cover. I could have written a book about threads without any help-I know a great deal about threads, and I am at least reasonably competent at written communication. However, the result would not have been this book, and this book is better than that hypothetical work could possibly have been.

Thanks first and foremost to my manager Jean Fullerton, who gave me the time and encouragement to write this book on the job-and thanks to the rest of the DECthreads team who kept things going while I wrote, including Brian Keane, Webb Scales, Jacqueline Berg, Richard Love, Peter Portante, Brian Silver, Mark Simons, and Steve Johnson.

Thanks to Garret Swart who, while he was with Digital at the Systems Research Center, got us involved with POSIX. Thanks to Nawaf Bitar who worked with Garret to create, literally overnight, the first draft of what became Pthreads, and who became POSIX thread evangelist through the difficult period of getting everyone to understand just what the heck this threading thing was all about anyway. Without Garret, and especially Nawaf, Pthreads might not exist, and certainly wouldn't be as good as it is. (The lack of perfection is not their responsibility-that's the way life is.)

Thanks to everyone who contributed to the design of cma, Pthreads, UNIX98, and to the users of DCE threads and DECthreads, for all the help, thought-provoking discourse, and assorted skin-thickening exercises, including Andrew Birrell, Paul Borman, Bob Conti, Bill Cox, Jeff Denham, Peter Gilbert, Rick Greer, Mike Grier, Kevin Harris, Ken Hobday, Mike Jones, Steve Kleiman, Bob Knighten, Leslie Lamport, Doug Locke, Paula Long, Finnbarr P. Murphy, Bill Noyce, Simon Patience, Harold Seigel, Al Simons, Jim Woodward, and John Zolnowsky.

Many thanks to all those who patiently reviewed the drafts of this book (and even to those who didn't seem so patient at times). Brian Kernighan, Rich Stevens, Dave Brownell, Bill Gallmeister, Ilan Ginzburg, Will Morse, Bryan O'Sullivan, Bob Robillard, Dave Ruddock, Bil Lewis, and many others suggested or motivated improvements in structure and detail-and provided additional skin-thickening exercises to keep me in shape. Devang Shah and Bart Smaalders answered some Solaris questions, and Bryan O'Sullivan suggested what became the "bailing programmers" analogy.

Thanks to John Wait and Lana Langlois at Addison Wesley Longman, who waited with great patience as a first-time writer struggled to balance writing a book with engineering and consulting commitments. Thanks to Pamela Yee and Erin Sweeney, who managed the book's production process, and to all the team (many of whose names I'll never know), who helped. Thanks to my wife, Anne Lederhos, and our daughters Amy and Alyssa, for all the things for which any writers may thank their families, including support, tolerance, and just being there. And thanks to Charles Dodgson (Lewis Carroll), who wrote extensively about threaded programming (and nearly everything else) in his classic works Alice's Adventures in Wonderland, Through the Looking-Glass, and The Hunting of the Snark.

Dave Butenhof
Digital Equipment Corporation
110 Spit Brook Road, ZKO2-3/Q18
Nashua, NH 03062
butenhof@zko.dec
December 1996

0201633922P04062001


Product Details

  • Paperback: 400 pages
  • Publisher: Addison-Wesley Professional; annotated edition edition (May 26, 1997)
  • Language: English
  • ISBN-10: 0201633922
  • ISBN-13: 978-0201633924
  • Product Dimensions: 9.1 x 7.4 x 0.8 inches
  • Shipping Weight: 1.4 pounds (View shipping rates and policies)
  • Average Customer Review: 4.4 out of 5 stars  See all reviews (24 customer reviews)
  • Amazon.com Sales Rank: #48,343 in Books (See Bestsellers in Books)

    Popular in this category: (What's this?)

    #17 in  Books > Computers & Internet > Operating Systems > Unix

More About the Author

David R. Butenhof
Discover books, learn about writers, read author blogs, and more.

Visit Amazon's David R. Butenhof Page

Look Inside This Book



Tags Customers Associate with This Product

 (What's this?)
Click on a tag to find related items, discussions, and people.
 
(4)

Your tags: Add your first tag
 

Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

 

Customer Reviews

24 Reviews
5 star:
 (14)
4 star:
 (6)
3 star:
 (3)
2 star:
 (1)
1 star:    (0)
 
 
 
 
 
Average Customer Review
4.4 out of 5 stars (24 customer reviews)
 
 
 
 
Share your thoughts with other customers:
Most Helpful Customer Reviews

 
70 of 73 people found the following review helpful:
3.0 out of 5 stars Annoying, but probably no worse than the rest..., February 13, 2001
By Richard Kirk (London United Kingdom) - See all my reviews
This book has got what you want to know about pthreads. If that was all it had, and it had that in the right order, then it would be perfect. Instead, this is a very frustrating book to read.

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.

Comment Comment (1) | Permalink | Was this review helpful to you? Yes No (Report this)



 
15 of 16 people found the following review helpful:
5.0 out of 5 stars Excellent book on Pthreads, January 4, 1999
By A Customer
This book was the best of 4 books that I've read on the topic. The coding examples were all very good and the text covered a great number of topics in the necessary detail (very clear and concise). I just wish I'd read this first -- I wouldn't have needed to read the other three books.
Comment Comment | Permalink | Was this review helpful to you? Yes No (Report this)



 
15 of 18 people found the following review helpful:
5.0 out of 5 stars The best (POSIX) Threads book I could find., February 23, 2000
By Ron (San Diego) - See all my reviews
This book is very focused on multi-threaded programming with an emphasis on POSIX threads. The example code is always carefully explained, and is always clear and to the point.

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!

Comment Comment | Permalink | Was this review helpful to you? Yes No (Report this)


Share your thoughts with other customers: Create your own review
 
 
 
Most Recent Customer Reviews

5.0 out of 5 stars Remember the rules
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. Read more
Published 7 months ago by Yong Zhi

5.0 out of 5 stars Exceptional
I have used pthreads pretty extensively. If there is any book close to being called bible,this is it. Go get it.
Published 13 months ago by Basker Mathrubootham

5.0 out of 5 stars A 'need to have' for experts and non-expers
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. Read more
Published 23 months ago by Dominik Zalewski

5.0 out of 5 stars The best book on the topic
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... Read more
Published on October 25, 2007 by Olivier Langlois

5.0 out of 5 stars Excellent book with practical advice for software developers
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... Read more
Published on July 27, 2007 by irotas

3.0 out of 5 stars Okayish
Pros:

- Understandable language

Cons:
- Need better explanations though. Read more
Published on June 30, 2007 by Siddhesh Nasnodkar

4.0 out of 5 stars Excellent for beginners; important details missing
I had no knowledge of thread programming before this book. With this book, I was able to create several multi-threaded socket communications programs. Read more
Published on September 1, 2005 by D. Rosario

4.0 out of 5 stars Better than some other reviewers thought
I started reading this book in 2000 when I already had programming experiences with threads (Linux/SUN/SGI/Windows thread packages). Read more
Published on October 28, 2004 by H. Wang

2.0 out of 5 stars A frustrating book
Richard Kirk's review below is the most accurate. There are many annoying things about this book. In addition, I find the code suspicious. Read more
Published on June 30, 2003 by JK Oregon

5.0 out of 5 stars Comprehensive and well-written
Butenhof covers all the details of programming the pthreads library. The book begins with a lucid and carefully presented discussion about the general concepts behind threading,... Read more
Published on April 21, 2003 by David Elder

Only search this product's reviews



Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Active discussions in related forums
Discussion Replies Latest Post
C# or Java? 55 9 hours ago
textbook scam 86 12 hours ago
Textbooks for Kindle DX? 71 11 days ago
Search Customer Discussions
Search all Amazon discussions
   




Product Information from the Amapedia Community

Beta (What's this?)


Look for Similar Items by Category


Look for Similar Items by Subject

 

Feedback

If you need help or have a question for Customer Service, contact us.
 Would you like to update product info or give feedback on images?
Is there any other feedback you would like to provide?

Your comments can help make our site better for everyone.


Your Recent History

 (What's this?)

After viewing product detail pages or search results, look here to find an easy way to navigate back to pages you are interested in.