Parallel Computing – Visual Studio 2010 - .NET 4.0

HTML clipboard

Parallel Library & Parallel LINQ

Most of the Laptops and Desktops support multi-core processor in it. Although we have multiple processors in the machine, our normal code will run in any one of the processor and not utilizing the multi-core processor for what they are made. Now the developers can take advantage of this robustness in multiple ways in their code, particularly when working on complex algorithms or while doing multiple tasks at the same time.

Microsoft's Visual Studio 2010 & .NET Framework 4 provided a way to achieve this by using the Parallel Library and Parallel LINQ in it.

For example, consider a webpage which has Header, Footer, Left hand pane, Right hand pane and the Content pane. As per the normal programming, each pane will be loaded sequentially and not in parallel. Surely it will take more time to load if each pane has to load the information from each data source.

How Parallel Computing solves this issue?

Normal programming will make use of only one processor and not utilizing the other processors even though it is idle over there. But when you implement the Parallel library or Parallel LINQ, it makes use of the other processors while executing the code. Following diagram will clearly illustrate you in detail.

Without using Parallel Library & Parallel LINQ


Above diagram illustrates that even though the machine has multi core processor, the code is executed using only one processor and each pane has taken one second to load, totally 4 seconds to load the page. Here the code is written without using any parallel library or parallel LINQ.
High performance sites say that a good web page should be completely loaded within 3 seconds. That kind of throughput or Threshold an application should have. Performance and Scalability are the two challenging areas for the Architect and Developers. Our programming should be improved so that its takes the advantage of the Multi Core processor and delivers a high performance websites.

Using Parallel Library & Parallel LINQ


Above diagram illustrates that the code has utilized all the processor in the machine and executed the each task in parallel and loaded in just 1 Second. This had happened due to the appropriate usage of Parallel Library & Parallel LINQ in the code. Developers should write the code that is capable of breaking large tasks into multiple smaller tasks that can be performed in parallel.
Utilize the Parallel Computing and engineer the performance for your websites. It's just the introduction about parallel computing, there were lot more stuff in it, so start parallel programming and leverage the advantage of it.