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.
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.
Excellent book with practical advice for software developers
Published by Thriftbooks.com User , 17 years ago
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?
Detailed and easy to understand
Published by Thriftbooks.com User , 25 years ago
This book is great for beginners in Posix. It is detailed and clear. It gives careful explanation of the major Posix functions and complement them with full source codes which compiles perfectly, making everything easier to understand.
The best (POSIX) Threads book I could find.
Published by Thriftbooks.com User , 25 years ago
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!
Excellent book on Pthreads
Published by Thriftbooks.com User , 26 years ago
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.
ThriftBooks sells millions of used books at the lowest everyday prices. We personally assess every book's quality and offer rare, out-of-print treasures. We deliver the joy of reading in recyclable packaging with free standard shipping on US orders over $15. ThriftBooks.com. Read more. Spend less.