A Tour Through the Parallel Programming Samples for .NET 4

A Tour Through the Parallel Programming Samples for .NET 4

Rate This
  • Comments 23

On Code Gallery, we have a plethora of samples that highlight aspects of the .NET Framework 4 that help with writing scalable and efficient parallel applications.  This post examines each of those samples, providing an overview of what each provides.

image Project Name: AcmePizza
Languages: C#, Visual Basic
Description: This simple and somewhat silly application demonstrates using concurrent collections with WPF.  The collections are wrapped with observable facades, such that multiple threads may modify the collections concurrently, and those updates are safely propagated to UI controls.
image Project Name: Antisocial Robots
Languages: C#
Description: Demonstrates doing a computationally-intensive operation many times per second, as a bunch of “robots” try to get as far away from each other as possible.
image Project Name: BabyNames
Languages: C#, Visual Basic
Description: This is one of the first applications we ever built to use Parallel LINQ.  Using LINQ and PLINQ, it queries a data set of baby name popularity information, sorts the results, and displays the results in a simplistic WPF user interface.
image Project Name: BlendImages
Languages: C#
Description: A demo of very simple image manipulation using a Parallel.For loop.  The application allows the user to load up two images and blends them together into a single, new image.
image Project Name: Boids
Languages: C#
Description: An implementation of a classic flocking algorithm, utilizing WPF for pretty 3D visualization of the “boids”, whose next positions and velocities are computing in parallel.
image Project Name: ComputePi
Languages: C#, Visual Basic
Description: A console application that estimates the value of PI using a variety of both serial and parallel implementations, the latter done with both PLINQ and the Parallel class.
image Project Name: DiningPhilosophers
Languages: C#, Visual Basic
Description: A WPF application that demonstrates the classic “Dining Philosophers” synchronization problem.  The application implements several solutions, including one based on asynchronous techniques using Tasks.
image Project Name: EditDistance
Languages: C#, Visual Basic
Description: A console application that uses Tasks to parallelize a dynamic programming problem, that of computing the “edit distance” between two strings.
image Project Name: GameOfLife
Languages: C#, Visual Basic
Description: This application provides an implementation of Conway’s Game of Life, using the Parallel class to parallelize the processing of the cellular automata.
image Project Name: ImageColorizer
Languages: C#, Visual Basic
Description: This application manipulates an image by converting the majority of the image to grayscale, except for portions of the image containing user-selected hues.
image Project Name: LINQRayTracer
Languages: C#, Visual Basic
Description: Based on Luke Hoban’s LINQ implementation of a ray tracer, this application parallelizes a computationally intensive LINQ query using PLINQ.
image Project Name: MandelbrotFractals
Languages: C#, C++/CLI
Description: This application provides an implementation of the classic Mandelbrot fractal, parallelizing the processing of the fractal using the Parallel class.
image Project Name: Morph
Languages: C#
Description: Implements a morphing algorithm between two images.  Parallelization is done using the Parallel class.
image Project Name: NBodySimulation
Languages: C#, F#
Description: Implements a classic n-body simulation using C# and WPF for the UI and using F# for the core computation. Parallelism is achieved using the Parallel class.
image Project Name: NQueens
Languages: C#, Visual Basic
Description: This application implements a solution to the N-Queens problem, using both LINQ and PLINQ.
image Project Name: OptionPricing
Languages: C#, Visual Basic
Description: This Excel VSTO application utilizes PLINQ to price Asian Options.
image Project Name: ParallelGrep
Languages: C#, Visual Basic
Description: This console application implements “grep” functionality across a file system using PLINQ.
image Project Name: PlinqKnobs
Languages: C#
Description: A simple console application that demonstrates some of the ways execution of a PLINQ query may be controlled and configured.
image Project Name: Raytracer
Languages: C#, Visual Basic, F#
Description: This Windows application provides an animated, ray-traced bouncing ball.  Sequential and parallel implementations are provided, as is a special parallel implementation that colors the animated image based on which thread was used to calculate which regions.
image Project Name: ShakespeareanMonkeys
Languages: C#, Visual Basic
Description: This application implements and parallelizes a genetic algorithm for breeding monkeys able to speak text from Hamlet.
image Project Name: SpellChecker
Languages: C#, Visual Basic
Description: This application implements and parallelizes a spellchecking algorithm based on the same edit distance calculation in the Edit Distance sample.
image Project Name: Strassens
Languages: C#
Description: This application implements several algorithms for performing and parallelizing matrix multiplication, including the Strassen algorithm.
image Project Name: Sudoku
Languages: C#, Visual Basic
Description: This is a fun application that provides a full Sudoku experience, including on-demand puzzle generation and solving.  Unlike many Sudoku demos which parallelize the solver, this implementation parallelizes the generator, using PLINQ.  It also demonstrates a use for speculative execution.
image Project Name: VisualizePartitioning
Languages: C#, Visual Basic
Description: This application demonstrates various approaches to partitioning as employed by both Parallel and PLINQ.
image Project Name: ParallelExtensionsExtras
Languages: C#
Description: This class library provides a plethora of interesting and useful extensions to take advantage of and complement the functionality available in the .NET Framework 4 for parallel programming.
Leave a Comment
  • Please add 7 and 5 and type the answer here:
  • Post
  • I also couldn't locate the System.Xaml dll file or Microsoft.cSharp dll either unfortunately.

    Thanks in advance,

    Chris

  • Hi Chris-

    Yes, these samples require Visual Studio 2010 and the .NET Framework 4.

  • Oh i see!

    Well, i'll have to download the trial version to test it out then!

    I was trying to look at the SpellChecker Code, to see if i could understand the code behind the ideas, but i wasn't able to view any code, is there any reason why?

  • You should be able to at least open the relevant .cs file in Visual Studio, and if nothing else you could always open it in notepad.  Good luck!

  • Thanks (:

    Thats what i was doing earlier - i made a mistake - and forgot to check the Window1.xaml.cs file. My mistake there.

    Thanks for your assistance, and thanks for uploading these great samples! (:

  • Hi Toub.

    In some examples I find the serial routines to be faster than parallel.

    Why is that?

    -Steffen

  • Hi Steffen-

    Which example(s) in particular are you seeing the serial version run faster, and what's your machine configuration?

  • Hi Toub.

    Somehow i lost the last comment. But i try again.

    I tried several examples with same result. But lets take the ComputePI example.

    Here SerialPI is faster than the parallelPI, but the ParallelPartitionerPi gives the fastest result.

    I run windows 7 64bit, with a dualcore processor. I also tried it on vmware, same result.

    Worst thing is that i tried to convince a friend of mine that parallel is the new thing, and he laughed about the results.

Page 2 of 2 (23 items) 12