Introduction

Now days, hardware supports 2 core and 4 core processor that help multiple thread to be executed at a same time.By using the advanced hardware, you can distribute your work across multiple processors simultaneously.

Architecture

Here is the Architecture of Parallel Computing. I took this diagram from the MSDN.

Reference: MSDN

Advantage and disadvantage of using Parallel computing:

Advantage

Suppose if you are running long method then you can send that particular method in the thread and you don’t need to wait until that method is executed.

Performance of the application is very fast.

Disadvantage

It’s a fire and forgets kind of mechanism. We don’t know when we get the result back. As per my knowledge its better to use in a dropdownlist. For example: In the long filling info such as Signup.

Here in this article I am working on VS2008. You can download Parallel Computing for VS 2008 here. Here in this article I am concentrating on PLINQ. For better understanding you first need to understand Parallel Enumerable Operators:

Code Part:

In some of the cases I have used LINQ to SQL. Diagram will look like this

Here I am working on only one table called employee. First let’s work on simple query. Here we are using AsParallel() operator.

Here we will see how to use AsOrdered() operator.

Here we will see how to use AsSequential() operator.

Now lets understand, how to use Exceptional Handling in PLINQ. To Catch the exception in PLINQ we need to use AggregateException.

Here we will see how to cancel the excution using WithCancellation() operator.

Hope this article would have given a good insight of the basics of the Parallel computing. Keep learning and reading my forthcoming articles.

Reference

About the Author

Full Name: anup hosurMember Level: Member Status: MemberMember Since: 8/1/2009 2:37:23 AMCountry: India https://wordpress.com/pages/anuphosur.wordpress.com https://wordpress.com/pages/anuphosur.wordpress.com
He is the .net developer with around 8 years of experience in technologies like c#, WCF, WPF and Asp.net. https://wordpress.com/pages/anuphosur.wordpress.com