c# - 为什么 PLinq 不支持超过 63 个并行线程?

标签 c# .net multithreading task-parallel-library plinq

我觉得问题很清楚了。 PLinq 不允许您创建超过 63 个线程(WithDegreeOfParallelism 不允许,抛出 ArgumentOutOfRangeException)。在极少数情况下,我们需要从线程池中获取超过 63 个线程(例如 I/O 操作,其中任务需要比平时更多的时间才能完成)。据我所知,Parallel 类也有同样的限制。有什么解决方法吗?这种限制的原因是什么?

最佳答案

引自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.

关于c# - 为什么 PLinq 不支持超过 63 个并行线程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6003094/

相关文章:

c# - ILNumerics 在向量上的简单数学运算与系统数组和 Math.NET 的性能对比

c# - 分离 Linq To SQL 和 DTO 的关注点

c# - 为什么我的File.Move()无法正常工作?

.net - IE 与 Chrome 证书处理,以及 XP 与 Windows 7 上的 SSL 通信

.net - 是否有 PTP(精确时间协议(protocol) | IEEE 1588)库?

android - 启动并等待 wifi 连接 - 线程

c# - 通过网络实例化游戏对象

c# - SetWindowsHookEx 对媒体键没有反应

c++ - 这个异步技巧会起作用还是当我访问它时状态会悬空?

python - 在后台运行 pika ioloop 或使用自定义 ioloop