开发者

Why PLinq doesn't support more than 63 parallel threads?

开发者 https://www.devze.com 2023-03-05 17:28 出处:网络
I think the question is clear. PLinq doesn\'t allow you to create more than 63 threads (WithDegreeOfParallelism doesn\'t allow it, throws ArgumentOutOfRangeException). In rare situations, we need to a

I think the question is clear. PLinq doesn't allow you to create more than 63 threads (WithDegreeOfParallelism doesn't allow it, throws ArgumentOutOfRangeException). In rare situations, we need to acquire more than 63 thread from thread pool (such as I/O operations, where a ta开发者_如何学Gosk needs more time to complete than usual). As far as I know, the Parallel class also has the same limitation. Is there any workaround? what's the reason for this limitation?


Quoted from this link:

With Parallel.For/ForEach, there's no implicit limit, however the ThreadPool in .NET 4 (which Parallel.For/ForEach target by default) will only use up to 64 logical processors. PLINQ in .NET 4 does have hard-coded limit of 63 partitions. As larger and larger machines become available, I expect you'll see such limitations removed, just as how with the latest versions of Windows the OS supports up to 256 logical processors.

0

精彩评论

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