Parallel programming in c# 4.0
In our daily programming routine we use thread mechanism to parallelize your code to distribute work across multiple processors . To take advantage of the hardware of today and tomorrow Visual Studio 2010 and the .NET Framework 4 enhance support for parallel programming by providing a new runtime, new class library types, and new diagnostic tools. Let’s start with a simple concept in parallel programming. Data Parallelism (Task Parallel Library) Data Parallelism describes how to create parallel for and foreach loops. In this article we will look into simple for loop in parallel programming world. In this application I wrote a simple method to calculate the Root of a given number. Let’s look into the executing time of for and Parallel.For loop methods. The below code took me 16 seconds to execute. I am using 2.8-Ghz dual core 64 bit processor with 4 GB of RAM. for (int i = 2; i < 20; i++) { var result = SumRootN(i); ...