Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does disabling a core affect running processes?

I have this application installed on my Macbook Pro that allows me to disable a core on my CPU. It got me wondering: How does disabling a core affect the running processes?

I am also interested if disabling a core has an affect on the following

  • Battery Life
  • Heat generation
  • Increased performance when the processor would normally be using less than 40% of both cores?
like image 736
epochwolf Avatar asked Nov 20 '08 20:11

epochwolf


People also ask

What does disabling CPU cores do?

Unused cores are disabled. Setting this option can: Reduce processor power usage. Improve overall performance for applications that benefit from higher performance cores rather than more processing cores.

How do cores affect processor performance?

A CPU that offers multiple cores may perform significantly better than a single-core CPU of the same speed. Multiple cores allow PCs to run multiple processes at the same time with greater ease, increasing your performance when multitasking or under the demands of powerful apps and programs.

Do processes run on different cores?

Yes, a single process can run multiple threads on different cores. Caching is specific to the hardware. Many modern Intel processors have three layers of caching, where the last level cache is shared across cores.


4 Answers

How does disabling a core affect the running processes?

It doesn't, unless the program you're using is phenomenally badly written. The OS scheduler will be alerted that the processor is no longer available, and will simply stop scheduling processes into that processor. Putting a process from "running" into "waiting" take microseconds, so the switch will appear instantaneous. The process will continue running on the other core as it becomes available and priority allows.

How does disabling a core affect battery Life

It will have a measurable but not significant effect - in some cases it will increase. In other words, you shouldn't see more than perhaps 5% decrease in energy usage as modern processors already employ aggressive power saving techniques. Processors don't run idle loops - they stop when there's no process ready to run. If the overall system load is low, the OS slows the processors down rather than stopping them, which has a similar savings effect.

In certain, very specific, usage scenarios, energy usage will go up due to how the OS uses the processors (more task switching, which leads to lower performance and higher processor utilisation).

How does disabling a core affect heat generation

As with power, it will be measurable, but not noticeable without careful measurement. Again, the processor already has exceptional power control and will moderate the clocks, voltage, and processor idle to match the load, regardless of how many processors are active.

How does disabling a core affect performance (assuming the processor is using less than 40% of both cores)

Processes are very 'peaky.' When you press a key or move the mouse it kicks off dozens of waiting processes, and wants 100% for a very short period of time.

By forcing the processor to run them one at a time instead of parallel, yes the overall average usage is only 80%, but it will feel laggy not just due to a lot of waiting processes, but also due to the task switching - every time a process is changed (due to priority, or it being finished, or interrupt, etc) the processor loads the OS task, which then runs the scheduler, which then loads the next task.

You're doubling the task switching load on one processor, which means you're running the OS code (scheduler, event manager, etc) much more frequently to keep up with the demand.

This is wasteful, and the performance decrease may actually be noticeable. This additional work would not necessarily need to be performed if the OS had the option of running both processors at 40% of their normal speed, for instance.

-Adam

like image 58
Adam Davis Avatar answered Nov 12 '22 05:11

Adam Davis


Interesting question. This gets somewhat involved. You were not super specific about exactly what you mean by "application that disables a core" and exactly what it does, but I presume from your question and the comment to another that this application is disabling the core in a OS kernel friendly way.

So, normally when OS X is running, there are many different possible threads/processes (I'll say threads from here on out) that are competing for CPU resources in the scheduler. When both cores of your Core 2 Duo processor are enabled, the kernel has the ability to be running two threads simultaneously - rotating both cores through everything that needs to run. When you disable one of the cores, the kernel is going to drop back to only dispatching work to a single core. Of course, this doesn't change the amount of work that needs to get done....it just cuts your potential execution performance in half.

You might not think this matters if your cores were averaging less than 50% busy, right? Well, it does matter in many circumstances and the reason is latency to execute stuff. If there is only one thread runnable at any time, then the second core is always useless, even if it still enabled. However in any situation where two or more threads become runnable....it is possible to take advantage of both cores and if one of them is disabled then the work to be done on the second thread can't even start until the previous thread executes for awhile and then gets swapped out. Assuming two threads with equal work to be done, clearly it is going to take twice as long for the second thread to get to completion compared to the dual core case. You may not notice this, depending how much work we are talking about here, but clearly the latency (responsiveness) at least in theory is going to be cut in half. Clearly, as the system loads up with more and more threads that need to run or threads that have more work to do, it will become progressively more obvious that everything is running - in effect - at half speed.

That was all pretty straight forward.

So what does this mean relative to heat dissipation and battery life?

Do you come out ahead here or not....because point in fact while you might be inclined to think you are drawing half as much power per unit time, work is in fact taking twice as long to complete.

The conclusion here is that disabling a core, in the end, will have very little if any impact on overall battery life because the OS and the CPU are already working together to throttle back the clocks and effectively shutdown a core that is not needed. That is, there is really little to no overhead in having a core in the waiting ready to be used when you need it. In fact, a system might actually have shorter battery life with only one core is used because all the other devices on the motherboard have to stay active longer as the CPU is taking longer to get the needed work done.

Relative to heat dissipation, the effect is similar. Clearly, the peak heat dissipation in terms of WATTS is dramatically cut down with only one core....because only one of two cores is actually active. However, again, that core will be running longer and the net total energy output (JOULES or WATT SECONDS) will be approximately the same...which is again why your battery life is largely unaffected in the one core vs. two core case.

like image 20
Tall Jeff Avatar answered Nov 12 '22 05:11

Tall Jeff


I'll presume that when you "disable" the core, you're really telling OS X to no longer process in parallel.

I'd also presume that the OS is clever enough to move processes around after you've disabled them :)

I don't think, however, you'd really see a huge improvement on power consumption or battery life, but it's a guess - the CPU is still getting power, just part of it isn't being accessed.

Also, and this is merely a theoretical question, mightn't running only one Core increase the likelihood of the CPU burning-out, unless care is taken to keep the thermal properties constant? Just a thought.

like image 42
warren Avatar answered Nov 12 '22 03:11

warren


It won't really affect your running processes. The scheduler will clear the running process from the core and just won't dedicate another proccess to it.
And now your scheduler just have to find a nice strategy to find a fair allocation of the processes to the remaining core.

  1. battery: marginal
  2. heat-diff: negligible ... with the 2x40%-load
  3. nonexistent or slightly worse
    • worse because now all processes have to be switched over the one and only core
    • before one process (and his context!) could have stayed all the time on one core
    • so this will add I/O ... and your only core has to wait for it (flushing the TLB and page table)
like image 30
Leonidas Avatar answered Nov 12 '22 04:11

Leonidas