5

According to this answer one of the programs that requires root access is SetCPU that can lower the CPU frequency when the phone is not used thus prolong battery life.

I don't get one thing - why does that require root? What could be the harm in reducing the CPU frequency?

4 Answers 4

3

1) Because only the root user can change the system's frequency/governor. It's a system level function call and only root can do that.

2) Under clocking really isn't the problem... It's over clocking. You can't really damage the device, but you could end up in an infinite boot loop and an average user may not know how to get out of that.

3) Also: you usually want to replace the kernel when over/under clocking to get new frequencies and possibly under volting to save power (but at the same time, you're going out of the parameters of the CPU and it may end up boot looping because no two CPUs are made exactly alike when you are doing things outside their normal operating parameters).

6

If have to disagree with Sparx, if you change the CPU frequency via the supported methods that every modern CPU provides, changing it, even in a fast sequence, doesn't affect stability. I would even rule out hardware damage, because of the sophisticated security mechanisms in modern CPUs (overheat protection, etc.).

Why can only root set the frequency and the frequency governor? Well, first because it's Linux that only allows root to do so. Second, I think that it's because the average user shouldn't care about. It's the system that decides which frequency is the best in the current situation. It does so automatically, without user intervention and it does the job good under Android (IMHO). While thinks like SetCPU can prolong battery life, it also can shorten it, if it's done wrong. The question here is: Do you believe that a 3rd party App does better battery management than the one that the manufacturer of the device? In certain cases sure, but not always.

4
  • If I set my freq too low, my device doesn't wake from deep sleep. That renders it unusable, until I pull the battery and reboot. Constant overclocking adds heat which is bad for any electronic component. The odds of a hardware failure are much higher. Oh, and if you want setCPU allows a user to use different governers - these tell the CPU how and when to scale up/down to improve either performance or battery life as a user may see fit.
    – Sparx
    Nov 21, 2011 at 19:29
  • I get your point. But it seems that setCPU uses some internal quirks to under-/overclock. Thats why I added "via the supported methods that every modern CPU provides", which should be safe on every CPU.
    – Flow
    Nov 21, 2011 at 19:32
  • But it would require "root", correct? I'm assuming you're talking about init scripts?
    – Sparx
    Nov 22, 2011 at 8:53
  • It would require "root", right. I am talking about everything the cpu freq governor is able to do and th e cpufred-set binary. Both are using the same system calls and won't be able to damage and/or make your system unstable.
    – Flow
    Nov 22, 2011 at 9:00
4

Mucking about with CPU frequencies can lead to instabilities in your system and might also lead to hardware damage. Such a critical function is best left out of the hands of normal users who don't really need to make such changes.

Since this most certainly a core (important) function, one needs root access.

2

Allowing cpu frequency to be set directly by user level process is a security issue. It's a hardware functionality that could affect other processes running on the system. On an ideal system, no user level process should be able to affect the execution of another user's processes, except through explicit interprocess communication (e.g. pipes, signals, files, etc).

Examples of damages that could be done:

  1. Battery life: a malicious or poorly written could set cpu at a constantly high level, draining more battery than is necessary, without attracting suspicion because it uses little cpu for itself.
  2. Poor performance: a malicious or poorly written app could set the cpu frequency at constantly low level, resulting in poor performance. This could then be used to trick user into purchasing our downloading unnecessary optimizer apps, among others.
  3. Conflicting cpu frequency set by multiple apps could lead to really unstable system performance and general havoc as they keep overriding each other. This reason alone could make the whole cpu frequency setting useless.

The solution to this? Any single process should not be able to directly set cpu frequency. Instead non root process should only be able to give hints, and the system could then pick the best frequency setting, taking into account the hints from all processes, system policy, and process accounting information. This is what cpufreq "governers" are. One of the job of operating system is to moderate access to shared resources.

Also, it should be noted that lowering cpu frequency does not always lead to better battery life, depending on the work load, lower frequency could also mean it takes longer time to finish the task, and this could easily negate the savings.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .