Search Wiki:
Resource Page Description
This sample illustrates how to using .NET4 parallel extensions.


In the following set of exercises, you will implement an application that calculates Pi by using a geometric approximation. Initially, you will perform the calculation in a single-threaded manner; you will then change the code to divide the calculation into discrete operations and perform the calculation by using thread pool threads. Finally, you will change the code to use the Task Parallel Library to perform each operation as a parallel task. In the process, you will uncover some data synchronization issues that you must deal with.

The algorithm that you will implement calculates Pi based on some simple mathematics and statistical sampling.
If you draw a circle of radius r and then draw a square with sides that touch the circle, the sides of the square are 2 * r in length, as shown in Figure 1.

Last edited Feb 27 2010 at 12:33 AM  by philpenn, version 2
Page view tracker