ripper234
ripper234

Reputation: 230028

How to use PLINQ for IO-bound tasks?

According to the answer to this question, there is no way to effectively use LINQ for IO bound tasks. Is there a way to gain better control, or is LINQ just not suited for such tasks?

Upvotes: 2

Views: 604

Answers (1)

Robert Harvey
Robert Harvey

Reputation: 180788

I don't agree with your conclusion. In the other question, Luke stated that:

From the MSDN documentation: "Degree of parallelism is the maximum number of concurrently executing tasks that will be used to process the query". WithDegreeOfParallelism is just a hint that PLINQ should use no more than n threads.

The fact that Plinq only decides to use two threads for your code instead of ten doesn't mean that it is unsuitable for IO bound tasks. It means (most likely) that two threads is optimal for your code, not ten.

Upvotes: 4

Related Questions