Book Review: Concurrent Programming on Windows
Concurrent Programming on Windows
Joe Duffy
Addison-Wesley, 2008
1008 pp., $49.99
ISBN: 978-0-321-43482-1
Let me get straight to the point -- anyone interested in parallel programming using the .NET Framework needs Joe Duffy's Concurrent Programming on Windows. It is the definitive work on the subject, written with great accuracy, clarity and an enthusiastic cadence that will prepare the reader for concurrent computing tasks. Duffy is one of the definitive experts on the topic, considering he was the progenitor of Parallel Language Integrated Query (PLINQ) which eventually morphed into the Parallel Extensions to the .NET Framework. While some of the book's source inspiration is from Joe's own weblog as well as some of his articles published in MSDN Magazine, a majority of the content was written and organized specifically to make learning concurrent programming on the Windows platform as painless and intuitive as possible. Duffy has indubitably succeeded with this herculean task.
Each of the 16 chapters are written more as essays rather than step-by-step tutorials. Taking this approach actually improved my retention of the material, as the author has a talent for describing such technical details in a digestible way. While there are occasional bold type keywords emphasized in these write-ups, there are no call-out boxes or tips written in six-point type along the margins. Some may bemoan the lack of such learning aids, but I found their absence kept me in the flow of the author's explanations and written voice. Plenty of code snippets help reinforce the ideas being asserted, but the book thankfully spends more ink on describing the processes and the reasons behind the technical approaches being advised versus having readers rely on reams of code listings to decipher the nuances of concurrency behind the code. In fact, this would be one of the few programming books that could actually make the cross media leap to an audio book format and survive with nearly all the key ideas and teachings intact.
Part I features two brief chapters setting the concurrent programming stage with the basic concepts of parallelism, state machines and coordinating data synchronization. Part II ("Mechanisms:) accounts for nearly half the book's weight and encompasses seven chapters covering threads and thread pools, kernel object, data and control synchronization, Asynchronous Programming Models (APMs), and the idea and utilization of fibers (a lightweight, cooperative scheduling thread-like mechanism that can reduce the cost of context switching; however, as of the .NET Framework 3.5 release, fibers remains exclusively accessible to Windows C++ developers). Part III contains five chapters centered around concurrent techniques such as memory consistency models, hardware atomicity, low-locks and deadlocks, priority inversion and starvation, general purpose lock-free FIFO queues, data and message-based parallelism and finally touching on the topic of performance and scalability as they apply to parallel hardware architectures, profiling in Visual Studio, garbage collection, and a discussion of Amdahl's Law ("the ability of a parallel algorithm to exhibit speedup over its sequential counterpart is inherently limited by the remaining sequential parts after parallelization") and Mellor-Crummey-Scott (MCS) Locks. The last section of the book on Systems covers overlapped, asynchronous and synchronous I/O thread cancellation, Single Threaded Apartment (STA) GUI threading models and .NET asynchronous GUI features, highlighting the BackgroundWorker package. The appendix contains two sections, one that lists 37 useful tips on designing reusable libraries for concurrent .NET programs (including obvious ones like "avoid blocking while you hold a lock" and not so obvious such as "consider using spin locks for high traffic leaf-level regions of code"), and the other providing an overview of the pieces that comprise the Parallel Extensions to .NET (based on the June 2008 Community Technology Preview) which includes the Task Parallel Library (TPL), Parallel Language Integrated Query (PLINQ) query provider and the various synchronous primitives and set of concurrent collections that are part of this package.
Whether you're a C++ or C# developer seeking the most comprehensive and enriching educational experience on the subject of parallel programming in the Windows environment, Concurrent Programming on Windows is a must have book. Much like Charles Petzold's highly regarded Programming Windows, Joe Duffy's book should have the honor of sitting on the same bookshelf as that essential tome, at least until the commercial computing world makes the full leap into parallel programming and such topics are as standard in future programming books as objects and threads are today.
This Week's Multicore Reading List
MATLAB and Google App Engine
Logging In C++ : Part 2
Improving log granularityA Conversation with BitMagic's Developer
Prefer Structured Lifetimes: Local, Nested, Bounded, Deterministic
- Intel Parallel Studio; Download the free eval today!
- Parallelism Breakthrough Video Series; Watch and learn more about Intel® Parallel Studio
- 2009 Intel Software Webinar Series; View On-Demand webinars
- Coding for Multi-core Processes; Intel® Compiler Pro eBook
- Performance Through Parallelism; Intel® Tuning for Vista eBook
- Intel® Software Network; Connect with developers and Intel engineers
-
November 17, 2009
Visual Effects for Animation - presented by DreamWorks Animation
Speaker: Ron Henderson (Bio)Ron Henderson manages the FX Tools group at DreamWorks Animation, where he is responsible for developing physical simulation and procedural modeling tools. These systems have been used for key visual effects in recent films such as Kung Fu Panda and Monsters vs. Aliens (March 2009).
Prior to joining DreamWorks in 2002 he was a senior scientist at Caltech with a joint appointment to the Applied Math and Aeronautics departments, where he worked on efficient techniques for the direct numerical simulation of fluid turbulence.Abstract:
In this webinar, Ron Henderson will show examples of visual effects, from hair and feathers to smoke and fire, from a variety of DreamWorks Animation feature films. He will discuss in general terms the kinds of techniques used to achieve particular visual effects. Finally, Henderson will show a detailed breakdown of the dam-breaking scene from Madagascar: Escape 2 Africa, demonstrating how different elements of key frame animation, simulation, and rendering are combined in a real production shot. -
December 1, 2009
A Quick and Easy Way to Parallelize a Legacy Codebase with Intel® Threading Building Blocks (TBBs)
Speaker: Bernard Laberge, Avid, Senior Principal Engineer (Bio)Bernard Laberge is a senior principal engineer in the video editors division at Avid. During his seven years with the company he has been actively involved in the replacement of the legacy video processing engines used by Avid editors with a common hardware-abstracted, component-based video processing engine currently running on the CPU with SIMD optimized code, GPU, and dedicated hardware.
Abstract:
Learn how to overcome the limitations of a thread-based scheduler, including dealing with the absence of recursive parallelism support and the inefficient handling of unbalanced processing load. Bernard Laberge addresses how Avid resolved the expensive refactoring of their thread-based scheduler into a task-based solution by choosing Intel® Threading Building Blocks (TBBs). He explores how Avid was able to easily integrate the Intel TBBs into their video editor applications and more than 5 million lines of code. -
December 15, 2009
How to Use Intel® Parallel Studio to Streamline Code Development in a Multicore Environment
Speaker: Matt Dunbar, Director for Performance Technology, SIMULIA (Bio)Matt Dunbar is the director for performance technology at SIMULIA. Since joining the company in 1993, he has worked on parallelization of the Abaqus suite of products, initially for shared memory architectures and more recently for distributed memory architectures. Dunbar has also been intimately involved in selecting both the hardware and software tools used in the development of the Abaqus product line.
Abstract:
Resolve elusive, costly multithreading errors quickly and efficiently with Intel® Parallel Studio. While many coding problems that lead to bugs in software applications are typically straightforward logic errors, errors in managing memory and in multithreading code can sometimes take weeks to months to diagnose and fix. Matt Dunbar explores how and why taking advantage of multicore processors through multithreaded code is critical for compute-intensive applications. While spotlighting his work on SIMULIA's Abaqus finite element solver, Dunbar addresses the need for multicore execution and shares his experiences using Intel Parallel Studio to streamline code development in a multicore environment.



