我一直在阅读有关线程池的内容。许多站点表示线程池上的默认最大线程数为 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/