For multi-processor systems Task Manager in Windows has allowed you to set which CPUs you want to allow a process to execute on. Until today I’ve not ever had a reason to use it for anything other than as a novelty.
Today though I’m doing a lot of data processing in PowerShell. I’m reading in a log file, and doing a foreach() on the resulting array to build up a table. This is evidently a single-threaded operation in PowerShell.
The Windows Process Scheduler tends to shift a busy process around between the logical CPUs, so even though the process is only running a single thread, you don’t see a one processor running high when you look at the graphs in (e.g.) Task Manager. I tend to assume that the people who program stuff like this know far better than I do why they do things in certain ways, however in my case today I’m not sure its working most effectively.
My PC has an Intel Xeon E3-1245 V2 CPU, which is a 3.4GHz CPU with 4 cores and Hyperthreading. 3.4GHz is the base frequency, it can go slower when the full speed isn’t needed – to save power – via Enhanced SpeedStep. However it can also go faster, on specific cores, via Intel Turbo Boost Technology. The Turbo Boost maximum speed on my CPU is 3.8GHz, and is achievable because the extra heat and power that this uses is offset by slowing other cores down thus stopping the overall CPU power consumption from rising to cause problems.
Here’s Task Manager showing PowerShell ISE running in its default state:
And here’s the CPU graphs, none is particularly high. Note the maximum CPU speed is shown, and the current CPU speed is 2.07GHz.
The logical CPU I selected is now running at 100%, and the CPU speed is now showing 3.71GHz. That’s not far off twice as fast as before.
The processing speed within my script increases from an average of 0.22MB/sec to 0.4MB/sec.