单线程应用程序是否只在一个 CPU 上运行
我正在一台 8 CPU 的机器上开发一个单线程应用程序,当一个繁重的操作发生时,CPU 利用率看起来像这样:
I am developing a single threaded application on an 8 CPU machine and when a heavy operation happens the CPU utilization appears like this :
.NET 框架是否具有将单个线程的工作(自动)划分到其他 CPU 的功能?
Does the .NET framework have some facility to divide the work of that single thread (automatically) into the other CPUs ?
不能保证任何单个线程总是在同一个内核上运行.但是可以保证它只会同时在一个核心上运行.但它可以在一个核心上运行直到上下文切换,并在另一个核心上的上下文切换后恢复.您的线程获得的每个时间片可能会分配到另一个核心上.
It's not guaranteed that any single thread will always run on the same core. But it's guaranteed that it will run only on one core at the same time. But it can run on one core till context switch, and resume after the context switch on another core. Each time-slice, your thread gets, may be allocated on another core.