Packt Publishing has recently published ".NET 4.5 Parallel Extensions Cookbook" by Brian Freeman which may be helpful as an introduction into new methods of working with multi-threaded applications available since .NET Framework 4.0. The book will be useful for those developers who already have experience with C#, basics of functional programming and Visual Studio. Previous knowledge of threads, thread pools and related concepts is not required though.
The author starts from detailed description of Task – how tasks should be created, cancelled, waited for completion, how exceptions should be handled and so on. Each small piece of information - which is called recipe in the book - is provided with code.
From single Task author then goes to description of continuations – how multiple tasks may be organized in program and how one task can be scheduled in case another task completes or fails. Idea of continuations helps to solve well-known problem of updating GUI in multi-threaded application.
Brian Freeman explains how to use parallel loops and parallel LINQ queries and, what is even more important, when they have advantages comparing to the similar sequential entities.
Other interesting topics covered in the book include: thread-safe collections, coordinating the work with various synchronization primitives, debugging of multi-threaded application using Parallel Stacks / Parallel Watch windows. Several recipes are devoted to Task Based Asynchronous Pattern.
Brian Freeman's book is a great reference for the developers who would like to start using Parallel Extensions library as soon as possible. Though to understand deeply how this library works inside, reading of some other books may be also required.