ThreadPool.SetMinThreads() 可以将completionPortThreads数量设置为0吗?
我想设置最小线程数。我知道我需要的工作线程的数量,但关于完成端口线程的大小应该是多少(默认情况下它等于处理器的数量)。我可以将其设置为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). can I set it to 0 or is it risky? when will it be used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您愿意,可以将最小线程数设置为 0。这意味着操作系统必须在需要时启动新线程,并在不需要时再次停止它们,并且可能会导致并发运行的任务减少,这两者都会对性能产生影响。
您不能将最大数量设置为小于处理器数量。
You can set the minimum number of threads to 0 if you like. 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.