Book Review: Professional Parallel Programming with C#

Learn how to master Parallel Extensions with .NET 4

Parallel extensions represents one of the most exciting additions to the .NET Framework 4. They allow .NET developers to leverage the full power of multicore computing architectures with relative ease. Although implementing and using extensions may be straightforward, it takes experience to learn their deeper aspects and nuances, along with the optimal situations in which to use them. Fortunately, Gastón Hillar, author of Wrox's Professional Parallel Programming with C#: Master Parallel Extensions with .NET 4, helps readers take the fast track to multiprocessor and multicore mastery.

The book is segmented into 11 chapters and three appendices. It starts with discussions on task-based programming, imperative data, and task parallelism. Understanding the complexity of the problem, Hillar sets the stage for the rest of the book from by first covering shared-memory multicore, distributed memory systems, and parallel programming along with the threading, concurrency, and scalability aspects associated with the approach parallel extensions. In fact, readers will do themselves a favor by carefully reading the first three chapters to gain a deeper understanding of, and confidence in, the underlying interactions in a parallel programming scenario. Once secure in this foundational knowledge, readers will find that concurrent collections and coordination data structures round out the basic curriculum on parallelism. Throughout the first five chapters, related .NET classes—such as System.Threading.Tasks.Parallel, System.Threading.Tasks.Task, and System.Collections.Concurrent (along with code examples)—are introduced. Chapter 6 covers Parallel LINQ (PLINQ), from partitioning and custom aggregate functions to PLINQ tasks, exception handling, and MapReduce algorithms.

The next chapter shows you how to debug parallel programs in the Visual Studio 2010 IDE. The good tips on viewing and debugging anonymous methods and threads, as well as on detecting deadlocks, come in handy. The next three chapters (focusing on thread pools via a WPF application example, asynchronous programming via the TaskFactory.FromAsync object, and testing and tuning parallel applications) also demonstrate Hillar's intimate understanding of the technology. He clearly describes the implementation and problems that might arise, such as over-subscription and under-subscription, I/O bottlenecks, thread overloads, and lock contentions. The last chapter covers vectorization, single instruction, multiple data (SIMD) instructions, and other parallel libraries. The appendices include more than 50 helpful summaries of .NET 4 parallelism class diagrams, concurrent structures, behaviors, and interaction UML diagrams. They conclude with an assortment of parallel extension extras, including algorithms, partners, task schedulers, and the like.

Code discussions are presented in a step-by-step fashion, with key lines bolded for easier identification of critical code. The book's frequent use of screen shots also makes the job of following along much simpler. Callout boxes help reinforce provide helpful reminders for readers—for example, using lingo (e.g., "cold" and "hot in the cache") and other takeaways from the author's own parallel programming experiences—to reinforce the book's lessons. Each chapter concludes with a bulleted summary of what you should have learned. It goes without saying that you may need to reread certain chapters to let the knowledge sink in and resonate further.

As with most Wrox titles, you can download the code from the book's website. I strongly encourage you to download the code so that you can follow along and make your own tweaks and changes to help you understand how these parallel concepts interrelate.

In summary, Professional Parallel Programming with C# delivers considerable value for the .NET professional seeking a comprehensive guide on Parallel Extensions for .NET Framework 4. Reading the book will not only help you understand the intricacies of the framework but will also improve your overall programming skills.

Mike Riley ([email protected]) is an advanced computing professional specializing in emerging technologies and new development trends. He is also a contributing editor for DevProConnections. Follow Mike on Twitter @mriley.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.