Computers are just as busy as the rest of us nowadays. They have lots of tasks to do at once, and need some cleverness to get them all done at the same time.That's why threads are seen more and more often as a new model for programming. Threads have been available for some time. The Mach operating system, the Distributed Computer Environment (DCE), and Windows NT all feature threads.One advantage of most UNIX implementations, as well as DCE, is that they conform to a recently ratified POSIX standard (originally 1003.4a, now 1003.1c), which allows your programs to be portable between them. POSIX threads are commonly known as pthreads, after the word that starts all the names of the function calls. The standard is supported by Solaris, OSF/1, AIX, and several other UNIX-based operating systems.The idea behind threads programming is to have multiple tasks running concurrently within the same program. They can share a single CPU as processes do, or take advantage of multiple CPUs when available. In either case, they provide a clean way to divide the tasks of a program while sharing data.A window interface can read input on dozens of different buttons, each responsible for a separate task. A network server has to accept simultaneous calls from many clients, providing each with reasonable response time. A multiprocessor runs a number-crunching program on several CPUs at once, combining the results when all are done. All these kinds of applications can benefit from threads.In this book you will learn not only what the pthread calls are, but when it is a good idea to use threads and how to make them efficient (which is the whole reason for using threads in the first place). The authors delves into performance issues, comparing threads to processes, contrasting kernel threads to user threads, and showing how to measure speed. He also describes in a simple, clear manner what all the advanced features are for, and how threads interact with the rest of the UNIX system.Topics
Old but good. I'd give this book 5 stars except that it's a technical reference manual, and, well, it's just not going to change my life. It will make my life easier, however.
This book is clear, cogent and eminently readable. It's a good introduction to threaded programming (and all the pitfalls therein) as well as the POSIX threads (Pthreads) interface. The examples are clear and well-thought-out, the code samples are plentiful. The authors never elide over important-but-subtle details nor do they waste your time on things you shoudldn't care about.
With all the sophisticated tools available today such as OpenMP, this book may seem quaint. However, before grasping at concepts or just using tools without any understanding of their makeup it would be wise to add this to your learning curve.
This book gives a good basic understanding of Pthreads. Of course, you will later have to apply it to the real world but as a learning tool, this is pretty darn good. The website or path on the site has changed since publication, but the examples are still there. Because I am using AIX, it does take a little time to convert from a GCC format to an AIX format. Then a little more time to apply AIX-specific advantages.
As you go from the front of the book to the end the samples are added to and new concepts become available. There are plenty of diagrams for the visual learner. I found the signal handling of great use.
Anyway, this book is not the end-all, be-all, of threads but it sure cleared many concepts up for me.