In the MSDN magazine article, Stephen Toub explains the use of parallel tasks like PLINQ in .Net 4.0. I recommend reading this article to get some insights on parallel operations whether you use them or not in your applications.

With the Parallel class, you can parallelize it simply as follows:

  1. Parallel.For(0, N, i => {
  2.   … // Process i here
  3. });

Here, the developer is still responsible for ensuring each iteration of the loop is in fact independent, but beyond that, the Parallel.For construct handles all aspects of this loop’s parallelization.

Read this article


Stephen Toub is a principal architect on the Parallel Computing Platform team at Microsoft.

Advertisements

Share your thoughts

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s