I've got an older laptop that I use as a media center on my TV and I'm usually installing/reinstalling/uninstalling different OS' and Apps to get it to run as smoothly as possible.
One thing I noticed was very strange. My laptop is a HP Pavilion G62 which has a triple core AMD processor running at 1800mhz. When I launch XBMC from in Windows 7 and look at the processor speeds, it clearly says 1800mhz. However, when I launch it from Ubuntu either from the launcher or as a session, it says the processor is only 800mhz.
I wanted to investigate further so I loaded up DXDIAG in Windows to see what the speed was. Sure enough, it indicates that it's 1800mhz. However, when launching HardInfo in Ubuntu, it tells me that the speed of each core is as follows: 1500mhz, 1500mhz, and 800mhz.
Does this mean that both the advertised processor speed and the speed detected by Windows are lying or rounded off? Or is there a problem with Ubuntu detecting my processor speeds and my system isn't running as optimally as it should? I'd be inclined to say the latter... mainly because it appears that Windows runs far smoother than Ubuntu does.
By default Ubuntu uses the ondemand frequency governor. To check/switch governors, install the
cpufrequtils
package like this:To check the current speed/governors of each core run:
You can set all cores to performance like this:
You can confirm that all cores are now running at their max frequency like this:
Note: this change is temporary. Once you reboot, it'll be back to ondemand.
Theoretical background: In a typical computer, the CPU is idle most of the time. To save power, modern CPUs implement frequency scaling - i.e. the operating system can tell the CPU to switch to lower frequency when the load is low. The technology is called SpeedStep in Intel processors and Cool'n'Quiet in AMD processors.
In Linux kernel frequency scaling is implemented by
cpufreq
infrastructure, which uses a concept of "governors" to control the frequency.The default governor is "ondemand", which increases the frequency once the processor utilisation raises above 95%. This allows CPU to save some power while idle yet to switch to full performance when there are things to do. There is some transition latency, measured in milliseconds, so when an idle CPU suddenly gets a big load it continues to chug at low frequency for a few milliseconds before switching to full power, so in certain situation this may result in slightly lower performance than when always running at full speed.
There are other governors, including the "performance" governor which always runs the CPU at its full frequency. This eliminates the switching latency, but may increase power consumption.
You may experiment with different governors as suggested in another answer, but I doubt it will produce dramatic results. They wouldn't make it a default unless it made sense in 99% of cases :)
Back to your question, though: most likely, Windows shows you the maximum possible CPU frequency (the one they advertise on the CPU's box), while Ubuntu shows you the actual frequency each of the CPU cores runs with at this particular moment. It does not mean that the CPU runs slower in Ubuntu. If it appears that Ubuntu runs slow on your laptop it most likely is caused by something else - for example, low RAM, slow hard drive etc. Modern Ubuntu certainly requires more resources than, say, Windows XP which you're likely to find on an older laptop.
More technical reading: