开发者

How to use PLINQ for IO-bound tasks?

According to t开发者_如何转开发he 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜