简体   繁体   English

如果您尝试在具有单核的计算机上使用TPL会发生什么?

[英]What happens if you try to utilize TPL on a computer with a single core?

Title does justice. 标题是公正的。

I'm building an application that uses TPL instead of Backgroundworker, but I'm wondering what might happen if you try to run TPL on a machine that doesn't use multi-core cpus. 我正在构建一个使用TPL而不是Backgroundworker的应用程序,但我想知道如果你尝试在不使用多核cpu的机器上运行TPL会发生什么。

Are there any compatibility issues? 有兼容性问题吗? Performance slow-downs? 业绩放缓? Or does application go boom? 或者应用程序是否会繁荣?

A singe-core PC can still do threading. 单核PC仍然可以进行线程化。

Everything should work normally, with the ThreadPool creating a very low number of threads (1 or 2 by default). 一切都应该正常工作,ThreadPool创建的线程数量非常少(默认为1或2)。

You still pay for the overhead of TPL but you will not normally get any benefits. 您仍然需要支付TPL的开销,但通常不会获得任何好处。

No issues, no measurable slow-down. 没有问题,没有可衡量的减速。 Of course also no speed-up for CPU-bound tasks. 当然也没有加速CPU绑定任务的速度。 TPL adapts automatically to the number of available cores. TPL自动适应可用内核的数量。

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

相关问题 强制 TPL 任务在单核上运行 - Force TPL Tasks to run on a single core 当您尝试取消已排队的计划Azure服务总线消息时会发生什么? - What happens when you try to cancel a scheduled Azure service bus message that has already been enqueued? 当您尝试将值设置为只读属性时会发生什么? - What happens when you try to set value to a read-only property? 如果计算机在保留内存映射文件时挂起,会发生什么情况? - What happens if computer hangs while persisting a memory-mapped file? 将传统的异步处理程序包装到TPL Task时 <T> 回调和状态会如何? - When wrapping traditional asynchronous handlers to TPL Task<T> what happens to the Callback and State? 当计算机脱机并且WebClient发出请求时会发生什么? - What happens when a computer is offline and a WebClient makes a request? 如果您在顶级类中有:base()会怎样? - What happens if you have :base() in the top class? 如果你突破Lock()语句会发生什么? - What happens if you break out of a Lock() statement? 创建任务时会发生什么? - What happens when you create a Task? 当您等待失败的任务时会发生什么 - What happens when you await a failed task
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM