简体   繁体   English

ThreadPool.SetMinThreads()是否可以将completionPortThreads编号设置为0?

[英]ThreadPool.SetMinThreads() can the completionPortThreads number be set to 0?

I want to set the minimum number of threads. 我想设置最小线程数。 I knoe the number of workerThreads I need but about the completionPortThreads what should be it's size (by dafault it is equal to the number of processors). 我知道我需要的workerThreads数量,但关于completionPortThreads的大小应该是多少(按dafault的值,它等于处理器的数量)。 can I set it to 0 or is it risky? 我可以将其设置为0还是有风险? when will it be used? 什么时候使用?

You can set the minimum number of threads to 0 if you like. 您可以根据需要将最小线程数设置为0。 This means that the OS will have to start new threads when they are required, and stop them again when they are not, and may result in fewer tasks running concurrently, both of which will have a performance impact. 这意味着操作系统将必须在需要它们时启动新线程,并在不需要它们时再次停止它们,并可能导致更少的并发任务同时运行,这都会对性能产生影响。

You cannot set the maximum number to less than the number of processors. 您不能将最大数量设置为小于处理器数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM