Want to see code run 7 times faster? Here we use parallel programming to make full use of our multi-core systems. Techniques include .NET Parallel.ForEach and also spinning up Tasks manually to take more control over the process. Along the way, we see how to write code that is easy to run in parallel (warning: it may start you down the path of functional programming). Use the hardware you have to run faster.
-
NonParalellizable
This is the "Mazes" project that is difficult to make parallel due to the nature of the algorithms. The algoritms all require sequential processing, meaning that the next step cannot be computed until the previous step has been completed. -
ParallelFor
This is the "Conway's Game of Life" project. This shows how to use Parallel.For to run multiple tasks in parallel. In addition, the "conway-performance" project compares different levels of parallel performance using Parallel.For and Task. -
ParalleWithTask
This is the "Digit Recognition" project that contains console applications to show single-threaded as well as parallel computation. There is also a desktop application to show performance differences side-by-side.
-
I'll Get Back to You: Task, Await, and Asynchronous Programming
A series of articles and videos that introduces to Task & Await -
Digit Recognition
A series of articles about the Digit Recognition project -
Jeremy Explores Mazes for Programmers
A series of articles that about the book Mazes for Programmers that lead to the "Mazes" project -
TDD and Conway's Game of Life
A series of articles and videos exploring Conway's Game of Life -
Book Review: Parallel Programming with Microsoft .NET
The book is from 2010 but is still relevant (particularly the introduction on selecting the right patterns). The book itself is available online here: Parallel Programming with Microsoft .NET. Although the Microsoft Docs lists it as no longer maintained, there is no direct equivalent. -
Get Func-y: Delegates in .NET
Articles and videos to get up-to-speed with delegates in C#, including Func and Action. -
Learn to Love Lambdas (and LINQ, Too!)
Articles and videos to get up-to-speed with lambda expressions in C#.