Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 task 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?

like image 407
Davita Avatar asked May 14 '11 16:05

Davita


1 Answers

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.

like image 91
Kevin LaBranche Avatar answered Oct 10 '22 23:10

Kevin LaBranche