c# - 线程池中的线程

标签 c# threadpool

我一直在阅读有关线程池的内容。许多站点表示线程池上的默认最大线程数为 25(每个处理器)。但是我没有修改最大线程,当我修改时:

Threadpool.GetAvailableThreads(out WorkThreads, out compPortThreads);

我得到 500,1000。我运行的是双核电脑,所以预计不会超过 50。

我的池中实际上有 500、1000 吗??

谢谢 约翰

最佳答案

这在版本之间发生了变化:

来自 the documentation of the ThreadPool class in Visual Studio 2005 :

There is one thread pool per process. The thread pool has a default size of 25 threads per available processor.

来自 the documentation of the ThreadPool class in Visual Studio 2010 :

There is one thread pool per process. The thread pool has a default size of 250 worker threads per available processor, and 1000 I/O completion threads.

作为一个有趣的旁注:对于 Visual Studio 2008,English documentation promise 250 个工作线程,而 German translation只给你 25。啊,错误翻译的乐趣......

关于c# - 线程池中的线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3494367/

相关文章:

c# - 异步.NET Console程序中的线程控制流

java - 返回第一个结束任务的Java中的任务执行器

带有 ThreadPool 的 Java Web 服务器没有响应

java - ExecutorService 固定池卡在单个任务上

c# - 指示方法仅在匿名事件处理程序完成后返回

c# - 条件 Lambda 表达式?

c# - 如何将完成端口操作(I/O 绑定(bind)函数)排队到 CLR 线程池

c# - 如何断言顺序不重要的 IEnumerable 参数?

c# - Windows Phone 7 - 使用 native DLL - 需要类和接口(interface)的 GUID

c# - 在 Winform 中打印数学方程 |报告