4
$\begingroup$
  1. From Wikipedia

    The power consumed by a CPU, is approximately proportional to CPU frequency, and to the square of the CPU voltage: $$ P = C V^2 f $$ (where C is capacitance, f is frequency and V is voltage).

    I wonder how that is derived from basic circuit theory?

    How is a CPU modeled as a circuit? Why is it modeled as a capacitance, how about a mixture of resistance, capacitance, and inductance?

    Is the above formula for $P$ related to that the energy/work of a capacitance is $$ W = \frac{C V^2}{2}? $$

    Do we have to distinguish between AC and DC circuits here?

  2. From another source, the temperature of a CPU is estimated as a constant factor $$ \text{Processor Temperature} = ( \text{C/W Value} \times \text{Overclocked Wattage}) + \text{Case Temperature} $$ where, if I understand correctly, $\text{Overclocked Wattage}$ is the $P$ in my first formula, and $\text{C/W Value}$ is the constant factor multiplied to $P$.

    I wonder why we can model the temperature as a linear function of $P$? Specifically, why is there a constant factor $\text{C/W Value}$?

  3. In practice, I have encountered two cases.

    When I scale down the CPU frequency, the CPU temperature decreases. If the CPU frequency is $f$ in my first part (is it?), then the first formula explains this case well.

    But there is another case that I cannot find explanation from the above parts. When I am running a heavy program, if I use another program called cpulimit in Linux to limit the percentage of CPU usage to for example $50\%$ for the program's process (originally there is no limitation, i.e. CPU usage percentage can be 100% for the program), the CPU temperature can also go down. How will you explain this?

    I posted my questions on https://superuser.com/questions/432377/whats-more-harmful-to-a-cpu-high-load-or-high-temperature, but replies (especially the one by Dennis) there don't seem convincing.

Thanks and regards! ?

$\endgroup$
1
  • $\begingroup$ FYI - a good, related Q&A on EE SE $\endgroup$
    – Seamus
    Commented Jan 22, 2022 at 0:04

2 Answers 2

6
$\begingroup$

Re question 1: A processor is obviously a very complex object, but it's made of from basic structures called logic gates. A logic gate consumes power mainly when it's changing state, and the frequency with which it changes state will probably be, on average, proportional to the clock frequency. To work out the work done whenever the gate changes state you can model it as a capacitor with some effective capacitance, $C_g$, and you get:

$$W = \frac{1}{2}C_gV^2$$

and the power is the work per state change times the number of state changes per second, so:

$$P_g \propto C_gV^2f$$

If you add up all the logic gates in the processor you can define an effective total capacitance, $C$, that will be the sum of all the gate capacitances, $C_g$, so:

$$P \propto CV^2f$$

You'd have to establish the constant of proportionality by experiment.

Re question 2: presumably the CPU is connected to a heatsink, and the equation is just saying that the heat flow into the heatsink (i.e. out of the CPU) is proportional to the temperature difference between the CPU and the (presumably roughly constant) temperature of the heatsink. This seems a reasonable approximation, but it is only an approximation.

Re question 3: there are a couple of possible mechanisms at work. Modern CPUs scale their clock frequencies depending on load, so by only loading at 50% the CPU may be running below it's maximum clock speed. I must admit I don't know how the clock scaling works in modern CPUs and the chaps at Stack Overflow or Superuser would probably know more about this.

The other possibility depends on what the CPU does in the 50% of the time it's not running your program. At the beginning of this answer I said that the frequency with which the logic gates change state will probably be, on average, proportional to the clock frequency. However the constant of proportionality will probably depend on what the CPU is doing. A CPU that is idling may be flipping fewer logic gates per second that the same CPU when it's crunching numbers, so an idling CPU will use less power. That explains why the power usage and hence temperature falls when you limit the CPU used by your program.

(I'm assuming it's not a dual core CPU and 50% means only using one core!)

$\endgroup$
6
  • $\begingroup$ +1. Thanks! So are you saying it is $P∝CV^2f$, not $P=CV^2f$? $\endgroup$
    – Tim
    Commented Jun 5, 2012 at 13:32
  • $\begingroup$ Yes, though remember that $C$ is an effective total capacitance so I suppose you could define $C$ as the capacitance that makes the constant of proportionality equal to one. $\endgroup$ Commented Jun 5, 2012 at 13:38
  • $\begingroup$ I wonder if the formulas that we have talked about so far are for AC or DC circuits? Do we have to distinguish between AC and DC circuits here? $\endgroup$
    – Tim
    Commented Jun 5, 2012 at 13:39
  • $\begingroup$ The formula is just based on how often a gate changes state and how much power is used when it changes state. This assumes the supply voltage is constant, so I guess it's for a DC power supply. In any case you couldn't operate a logic gate from an AC supply. $\endgroup$ Commented Jun 5, 2012 at 13:42
  • $\begingroup$ (1) I wonder if $W$ and $P$ are for energy and power that CPU consumes or dissipate/release? (2) Is all of it dissipated in the form of heat and therefore raising the CPU temperature, or just part of it? $\endgroup$
    – Tim
    Commented Jun 5, 2012 at 19:05
3
$\begingroup$

The previous answer is mostly correct. I'll add some of the finer points here. My background is a recently-retired CPU designer, and I've done the power calculations many times (for server-scale computers rather than for mobile, though they're much the same).

CV2F loss is described reasonably correctly. Remember that an ideal capacitor does not actually burn any power; the power is expended in the "resistor" that is charging or discharging the capacitor. In a CPU, this "resistor" is partially the effective resistance of the transistor that controls the capacitor, and partially the series resistance of the metal wires in the circuit.

As described above, the calculation is exact rather than proportional simply because the "C" is indeed an effective capacitance rather than actual. The "effective" encompasses several factors. First, and most importantly, not every node will switch on every clock cycle -- not by a very long shot. To economize on power (which is hugely important in today's CPUs), CPU design engineers spend lots of time figuring out how to perform calculations while switching as few nodes as possible. Second, the "CV2" is of course simply the power required to charge a capacitor. Not every node in a CPU charges/discharges to the same voltage. This is partially because different parts of the CPU run from different power supplies, and partially because the intricacies of semiconductor physics (e.g., the MOS body effect) prevents some nodes from swinging to their full supply voltage. So, yes, the effective capacitances are typically simply computed to match a prior simulation.

However, an important point was not mentioned. You've no doubt heard of "Moore's Law," by which semiconductor devices scale down in size every few years. One of the unfortunate side effects of this scaling is that, every generation, CV2F power takes up less and less of the total power budget and simple static power takes up more and more. The fancy names for this type of power expenditure are often "gate leakage" and "subthreshold leakage." The bottom line, though, is that this type of power expenditure is insensitive to frequency -- circuits are burning power whether they are toggling or not, as long as they are hooked up to a power supply. As mentioned, this is becoming more and more of the total power budget.

Also note that, for CPUs, this is purely a DC phenomenon. With a very small number of exceptions, CPUs do not use AC power at all.

Finally, a bit more detail on your final question. As mentioned, CPU designers work very hard to make as few nodes toggle as possible. If every node on the CPU ever toggled at once, the power budget would be blown by a long shot. One of the "big-hammer" techniques used quite often is limiting the amount of instructions that are issued. For example, a dual-core CPU might only use one core. Or, any single core that is capable of issuing four instructions every cycle might limit itself to only issuing two. Or (since floating-point computation is very power intensive), a CPU might shut off floating-point instructions for a short time. Whatever the actual mechanism used, there are various ways that the restrictions might be turned on and off. Some CPUs will have the capability of monitoring their effective capacitance on the fly and restricting themselves accordingly. Others might depend on the operating system to read a temperature sensor somewhere and throttle the CPU when needed. In still other CPUs, the power-control mechanism has nothing to do with throttling; instead, they drop both their voltage and their clock frequency. (Note that lowering the voltage of a CPU lowers the current that transistors can deliver, which forces you to drop frequency as well). It is also quite common for an external program (such as the "cpulimit" you speak of) to be able to tell the chip to throttle itself. Whatever the reason, this throttling will limit the power of the CPU (and hence lower the temperature) for the obvious reasons. It is limiting the work that the CPU is doing, and hence reducing the number of nodes that switch, and hence lowering the effective capacitance. Or, again depending on the CPU, it will force the CPU to lower voltage and frequency, with the same effect.

$\endgroup$
2
  • $\begingroup$ Don't forget the HLT instruction on x86 processors (and equivalent instructions elsewhere, I'm sure) which is the OS's way of telling the CPU, "nothing to do -- enter lowish-power mode until there's an interrupt or something". $\endgroup$
    – Phil Frost
    Commented Jan 8, 2015 at 23:23
  • $\begingroup$ @Phil: very true. $\endgroup$
    – JoelG
    Commented Jan 9, 2015 at 11:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.