Preface

The multicore processor boom is fully underway. It is becoming difficult to find a server, desktop, or laptop that doesn't have at least two processor cores. There are even several models of dual core mobile phones on the market.

However, to fully realize the power of modern multicore processors, developers need to be able to effectively recognize opportunities for parallelization and write parallel code.

Largely due to the complexities of creating and managing the lifecycle of classic threads, parallel coding is not routinely practiced by the large majority of developers.

To help ease the complexities of writing parallel code, Microsoft has introduced the Parallel Extensions in .NET framework. The Parallel Extensions or Task Parallel Library helps us to write efficient, scalable, parallel code in a natural manner without having to deal directly with the classic threading model or the thread pool. Using these extensions, we can conveniently write parallel versions of existing sequential code that can automatically utilize all available processors, thus providing significant performance gains.

This book provides coverage of the major classes of the .Net 4.5 Parallel extensions from front to back, and will provide a developer with no multithreaded development experience ability to write highly scalable asynchronous applications that take advantage of today's hardware.

What this book covers

Chapter 1, Getting Started with Task Parallel Library, looks at the various ways to create and start a task, cancel a task, handle exceptions in a task, and control the behavior of a task. At the core of the .NET Parallel Extensions is the System.Threading.Task class.

Chapter 2, Implementing Continuations, helps us learn how to create task continuations and child tasks. We will also learn how to control the condition under which continuations run, how to handle exceptions using continuations, and how to chain tasks and continuations together to form a pipeline pattern. In asynchronous programming, it is very common for one asynchronous operation to invoke a second operation and pass data to it.

Chapter 3, Learning Concurrency with Parallel Loops, helps us learn how to use parallel loops to process large collections of data in parallel. We will also learn how to control the degree of parallelism in loops, break out of loops, and partition source data for loop processing.

Chapter 4, Parallel LINQ, helps us learn how to create a parallel LINQ query, control query options such as results merging, and the degree of parallelism for the query. Parallel LINQ is a parallel implementation of LINQ to Objects.

Chapter 5, Concurrent Collections, helps us learn how to use concurrent collections as a data buffer in a producer-consumer pattern, how to add blocking and bounding to a custom collection, and how to use multiple concurrent collections for forming a pipeline. Concurrent collections in .NET Framework 4.5 allows developers to create type-safe as well as thread-safe collections.

Chapter 6, Synchronization Primitives, helps us look at the synchronization primitives available in the .NET Framework, and how to use the new lightweight synchronization primitives. Parallel applications usually need to manage access to some kind of shared data.

Chapter 7, Profiling and Debugging, helps us examine the parallel debugging and profiling tools build into Visual Studio 2012, and how to use them to debug and optimize our parallel applications.

Chapter 8, Async, helps us learn about the Async feature of the .NET Framework, and using asynchrony to maintain a responsive UI. We've all seen client applications that don't respond to mouse events or update the display for noticeable periods of time due to synchronous code holding on to the single UI thread for too long.

Chapter 9, Dataflow Library, helps us examine the various types of dataflow blocks provided by Microsoft, and how to use them to form a data processing pipeline. The Task Parallel Library's dataflow library is a new set of classes that are designed to increase the robustness of highly concurrent applications by using asynchronous message passing and pipelining to obtain more control and better performance than manual threading.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.4.176