All about Async/Await, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more…
Reed Copsey, Jr. has been writing a great series of articles on parallelism with the .NET Framework 4. The articles provide the insights of an expert developer who has been using parallelism with .NET to speed up real-world programs. Recommended reading.
Parallelism in .NET
Part 1, Decomposition
Part 2, Simple Imperative Data Parallelism
Part 3, Imperative Data Parallelism: Early Termination
Part 4, Imperative Data Parallelism: Aggregation
Part 5, Partitioning of Work
Part 6, Declarative Data Parallelism
Part 7, Some Differences between PLINQ and LINQ to Objects
Part 8, PLINQ’s ForAll Method
Part 9, Configuration in PLINQ and TPL
Part 10, Cancellation in PLINQ and the Parallel class
Thanks for the plug, Igor!
FYI - I'm planning to continue this series, hopefully covering all of the basics of PLINQ and the TPL.
Is there any reason to use Parallelism in an ASP.NET Environment. In other words, should I use Parallel.For in an ASP.NET page code behind or does IIS take care of Parallelism for me?
ASP.NET automatically provides a request-level parallelism. From what I understand, handlers for different requests will be scheduled as different work items on the ThreadPool.
However, you can still consider using Parallel.For for parallelism within a single request. If you have relatively few requests coming in and each request is expensive, parallelizing each request el may help you lower the latency of responses.
Whether or not this will be beneficial depends on your particular workload. Hope this helps,