Amazon.com: Multithreaded Programming with Win32 (9780130109125): Thuan Q. Pham, Pankaj K. Garg: Books

Have one to sell? Sell yours here
Multithreaded Programming with Win32
 
See larger image
 
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Multithreaded Programming with Win32 [Paperback]

Thuan Q. Pham (Author), Pankaj K. Garg (Author)
3.8 out of 5 stars  See all reviews (4 customer reviews)


Available from these sellers.



Book Description

November 16, 1998 Prentice Hall Series on Microsoft Technologies
Learn practical Win32 multithreading techniques that can make all your Windows NT software faster and more responsive. Start by understanding how multithreading works, and the fundamentals of the Windows NT Thread Interface, including processes, thread management, creation, termination, and prioritization. Review the key techniques Win32 provides for thread synchronization, with practical examples of how to use them most effectively. Understand the role of monitors and data encapsulation. Next, use Microsoft's deadlock detection, prevention and recovery techniques to avoid the classic conditions known to crash multithreaded systems. Learn about the thread-package architecture and implementations, including user-level, kernel-level and multiplexed threads, and the scheduler. You'll also find great coverage of Java threads -- and an exceptionally useful chapter on multithreading in distributed applications, using Microsoft's DCOM technology.

Customers Who Bought This Item Also Bought


Editorial Reviews

Amazon.com Review

Adding multithreaded processing to your applications can make them faster and more responsive. The authors of Multithreaded Programming with Win32 show you how to take advantage of threads through practical, easy-to-understand examples.

The book begins with a history of threads, which were implemented rather recently (in 1979). They look at Win32 threads in particular, including all the APIs used to create and control threads. (Several of the sample programs here use graphics and even rudimentary games--such as a simple version of Pong.)

After you create threads, the authors teach you how to get them to work together. They do a fine job of explaining all the Win32 synchronization objects, such as mutexes, critical sections, and event objects, in a clear and concise style.

The strategies for coordinating threads have been well known in computer science for some time. The authors present common thread scenarios using the producer-consumer, bounded buffers, and readers-writers solutions. They explore the concept of thread monitors, for greater abstraction when controlling resources, and discuss deadlock analysis, with strategies to prevent threads from freezing.

Later, the book moves on to some programming strategies for allocating work between threads, using models like the workgroup, manager-worker, and pipeline to solve problems. The book closes with a few examples of threads used across the enterprise, including Microsoft's DCOM.

In all, this guide proves remarkably engaging and effective. The authors present many useful code examples of multithreading in action, which will get you started using threads in your own programs. --Richard Dragan

From the Inside Flap

Preface In this book, we describe techniques for designing and implementing multithreaded software applications. Multithreaded programming can effectively improve efficiency and performance in an application program by introducing concurrency or parallelism. Until recently, concurrent programming required multiple processes, each with a single thread of execution, running concurrently on a multitasking operating system. In the past, concurrent programming was a tool used mostly by researchers and system implementors, that is, programmers of operating systems, networking, and other systems software. Modern operating systems like Solaris, AIX, DEC-UNIX, Windows 98, Windows NT, HP-UX, and Linux, all support multiple threads of control within the same address space. With the wide availability of multiprocessor computers in the coming years, multithreaded programming will be a viable and important technique for application programmers to master. With threads, a process can have multiple instruction streams executing simultaneously with much lower overhead than concurrent processes. Threads within the same address space inherently share that process's memory, which makes communication and data sharing among threads efficient. In addition, multithreading technology is absolutely essential for domains such as real-time multimedia and distributed systems. Andrew Birrell, in his excellent tutorial, Programming with Threads, lists five main benefits of multithreaded programming: (1) greater speed from multiprocessor computers, (2) improved program efficiency by avoiding waits associated with slow-speed I/O devices, (3) multiple inputs from a user at the same time, (4) simpler server programs, and (5) responsive programs with computations judiciously spread over time. Developing programs that exploit these benefits of multithreading, however, is a challenge; the presence of parallelism introduces a new set of problems like resource sharing, deadlocks, race conditions, and so forth. The purpose of this book is both to introduce you to the concept of multithreaded programming, and to demonstrate how some of these challenges can be overcome. We have tried to cover all the important aspects of multithreaded programming, and to create a book that you will want to read as a primer book and use later as a reference guide. Outline of Chapters Chapter 1 introduces the basic concepts, history, benefits, and challenges of multithreaded programming. To provide an immediate hands-on experience, this chapter presents a small multithreaded program for you to experiment with right away. Chapter 2 introduces the Win32 thread interface and discusses its use. Here we also discuss the concepts of processes and threads, illustrate thread management functions, describe thread priorities and scheduling, and examine synchronization objects. In Chapter 3 we discuss the fundamental techniques for synchronizing threads of a multithreaded application. Using classic concurrency problems of producer-consumer, bounded-buffer, and readers-writers, we demonstrate synchronization techniques using the threads interface described in Chapter 2. Chapters 4 and 5 introduce monitors, an important abstraction and tool for multithreaded programming. While Chapter 4 describes the structure and properties of monitors, Chapter 5 simulates monitors using a combination of C++ classes and Win32 synchronization objects. Once again, we use concurrency problems of producer-consumer, bounded-buffer, and readers-writers to illustrate and demonstrate the usefulness of monitors in these chapters. Chapter 6 covers system deadlock in detail. In this chapter, we describe conditions for deadlock and explore techniques for avoiding it. Using the classic dining philosophers' problem, we demonstrate how to apply several deadlock- handling techniques like deadlock detection and recovery, prevention, and avoidance to application programs. Chapter 7 surveys a variety of thread package architectures, including user-level threads, kernel threads, multiplexed threads, and scheduler activations. We describe the impact of each thread architecture on the design and implementation of multithreaded programs. Chapter 8 covers the important topic of how to break up an application into multiple threads. We present illustrative programming models, including work groups, manager-worker, deferred computation, pipeline, and WorkCrew. Each model is illustrated using a sample program. In Chapter 9 we describe how threads can be used in the client and server components of a distributed application. Multithreaded programming plays an important role in this domain. We show the basic steps for constructing a distributed application using Microsofts' Remote Procedure Call (RPC) and Distributed Component Object Model (DCOM). The concurrent programming techniques covered in this book are well known in the computer science research community and are discussed in technical publications and several operating system textbooks. These concepts have, however, only recently become available for application programmers. The target audience for this book are application developers who want to experiment with multithreaded programming, and who have a working knowledge of the C programming language. Some parts of the book require a knowledge of the C++ language and the Visual C++ programming environement. We do not describe the threads API of the Microsoft Foundation Classes (MFC). The examples have been implemented on Intel Pentium machines running the Windows NT 4.0 Workstation operating system. Also, for clarity and brevity of exposition, we have removed error-checking code from the listings presented in the book except where such code is essential to the content under discussion. Acknowledgments Scott Marovich provided invaluable assistance with the preparation of this book: he carefully went through several versions, pointing out numerous corrections and improvements. Scott, thank you! We thank Anthony T. Nguyen for his early discussions with us on the book. We thank Nawaf Bitar for his valuable review and feedback for this book's proposal. We thank Debbie Caswell for her review of earlier versions of the book and encouraging comments about it. We thank Mary Franz, our editor at Prentice Hall, for initially suggesting the project, for patiently guiding us through the process, and for her eternal optimism. We thank Derrick Burns, Jill Huchital, Mehdi Jazayeri, John Krystynak, Srikanth Nadhamuni, and Thu Nguyen for their comments on earlier versions of the book. We thank Craig Little, our production editor, for patiently working with us on this project, and Scott Disanno for his careful copyediting of the book. Thuan thanks his wonderful wife, Nicole Anh-Dao, for all the support, encouragement, patience, and understanding that has made this project possible. Pankaj thanks his parents, Shri Harish Chand Garg and Smt. Savitri Garg for their love, affection and care. He thanks Puna, for her caring and wonderful companionship, his sister, Priti, and brother-in-law, Ajay, and all his friends for their encouragement and support.

Product Details

  • Paperback: 320 pages
  • Publisher: Prentice Hall Ptr (November 16, 1998)
  • Language: English
  • ISBN-10: 0130109126
  • ISBN-13: 978-0130109125
  • Product Dimensions: 9.1 x 6.9 x 0.8 inches
  • Shipping Weight: 3.3 pounds
  • Average Customer Review: 3.8 out of 5 stars  See all reviews (4 customer reviews)
  • Amazon Best Sellers Rank: #2,538,725 in Books (See Top 100 in Books)

 

Customer Reviews

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

21 of 21 people found the following review helpful:
2.0 out of 5 stars Quick Look Encounters Errors and Typos, November 6, 1999
By 
Amazon Verified Purchase(What's this?)
This review is from: Multithreaded Programming with Win32 (Paperback)
In the sections I have had to study, the book is obviously filled with typos. Sadly, it is another example of a poorly edited computer book. P.118 talks of a GetBothForks function. In the example, that function does not exist. There is a function called GetForks. That may be what they are referring to(?) On the next page the book discusses Preemption. The lines referenced in the example are obviously not the lines intended. In other words, references to lines 9-13 are probably really referencing lines 15 - 20(?) Finally, that solution is essentially the same as the previous. The first question a good student would ask is what is the difference? Of course, I guess the book does not pre-suppose a good student is reading. In summary, not edited well and therefore not trustworthy.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


5 of 6 people found the following review helpful:
5.0 out of 5 stars Clear, concise natural progression with good examples, April 20, 1999
By A Customer
This review is from: Multithreaded Programming with Win32 (Paperback)
This book is very easy to read and follows a natural progression from the problem of why multithreads are needed and how to go about solving the problem. Simple examples of a single reader and single writer thread are presented first followed by increasingly more complex examples of multiple readers and multiple writers with the changes clearly pointed out. I was able to skip around with ease and applied the concepts to my own application within hours. The chapters on monitors were well written - the first chapter in an abstract manner to illustrate the point followed by another chapter that had the actual guts of the code. The chapter on deadlock analysis was very useful in pointing out the issue of deadlock avoidance through the use of preemptive threads. This was important in my application where threads have to yield resources when their allotted cpu time was up.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


5.0 out of 5 stars Review on Multithreaded Programming Book, September 7, 2010
Amazon Verified Purchase(What's this?)
This review is from: Multithreaded Programming with Win32 (Paperback)
http://www.amazon.com/gp/product/0130109126/ref=cm_cr_rev_prod_title

This book is a good place to start if you want to expand your knowledge of using multiple threads in a program. This book also is a good place to start for someone who wants to learn win32 api.

Multithreaded programming is a must in every program released from now on! With multicore processors and multiple processor computers becoming the norm, applications that take advantage of multiple thread will just blow the socks off of your customers for a while, and then keep people happy later.

REMEMBER THOUGH: Multiple threads, etc. are NO SUBSTITUTE for well written and compiled programs.

Hope you all enjoy!
Caleb Begly
Crystal River Computers
[...]


Languages: C++, VB, PHP, Apache, Perl.

BEGINNING PROGRAMMERS:
Confused? Start out with C++; the rest follow naturally.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No

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


Only search this product's reviews



What Other Items Do Customers Buy After Viewing This Item?


Tags Customers Associate with This Product

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

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 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
 

Search Customer Discussions
Search all Amazon discussions
   


Listmania!


Create a Listmania! list

So You'd Like to...


Create a guide


Look for Similar Items by Category


Look for Similar Items by Subject