Max Degree of Parallelism for AsParallel()

You can use ParallelEnumerable.WithDegreeOfParallelism: Sets the degree of parallelism to use in a query. Degree of parallelism is the maximum number of concurrently executing tasks that will be used to process the query. var result = Tabel.AsEnumberable() .AsParallel() .WithDegreeOfParallelism(number) .Where(/* predicate */); Edit: @svick provided an excellent on ParallelOptions.MaxDegreeOfParallelism vs PLINQ’s WithDegreeOfParallelism which emphasizes the … Read more

Exactly what is PLINQ?

This is Parallel LINQ. It’s a way to run LINQ queries in parallel on multi-core/multi-processor systems, in order to (hopefully) speed them up. There is a good article on this in MSDN Magazine. For current details and plans, I recommend reading articles on the Parallel Programming with .NET Team Blog. They are the team implementing … Read more

How do Reactive Framework, PLINQ, TPL and Parallel Extensions relate to each other?

PLINQ (Parallel Linq) is simply a new way to write regular Linq queries so that they run in parallel – in other words, the Framework will automatically take care of running your query across multiple threads so that they finish faster (i.e. using multiple CPU cores). For example, let’s say that you have a bunch … Read more

When to dispose CancellationTokenSource?

Speaking about whether it’s really necessary to call Dispose on CancellationTokenSource… I had a memory leak in my project and it turned out that CancellationTokenSource was the problem. My project has a service, that is constantly reading database and fires off different tasks, and I was passing linked cancellation tokens to my workers, so even … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)