Modern CPUs reduce the clock speed automatically when idle. This is normally a good thing and works completely transparently to the user, e.g., Intel Speedstep technology. On the other hand, some CPUs can even go beyond their maximum speed, when they are not too hot, e.g., Intel TurboBoost. Note other CPU manufacturers have similar technology.
This way the user gets maximum CPU power at minimum power consumption.
It turns out that sometimes these technologies don't work as intended. I face that problem frequently with a program called Squid. The CPU usage when drawing in Squid on my Surface is low, which implies a low MHz speed of my CPU. As a consequence everything feels slow and there is noticeable lag when drawing.
Under Linux you can set the speed of a CPU core as "root user" with
echo 800000 > /sys/devices/system/cpu/cpuXX/cpufreq/scaling_min_freq
echo 1000000 > /sys/devices/system/cpu/cpuXX/cpufreq/scaling_max_freq
where XX is your CPU core, e.g., 0 for first core. 800000 is equivalent to 0.8 GHz, which is the minimum speed of my CPU. These commands would limit the CPU to operate only between 0.8 GHz and 1 GHz, which can be useful on a laptop to extend battery life. Setting the minimum and maximum scaling frequency to your maximum CPU speed would let run your computer at maximum speed.
Under Windows RM clock was the last program I used that permitted easy CPU speed manipulation. That program only worked with CPUs up to Pentium M/AMD Athlon. If anyone know of programs that allow easy clock manipulation, please add in the comment section.
Under Windows there is one option in the "Power Options" that permits manipulating the CPU speed, called "Minimum processor state" and "Maximum processor state". You may need to enable those settings by manipulating the Windows registry. So use at your own risk.
This article Power Options - Add or Remove "Min/Max processor state" describes how to enable and disable the settings.
So, for working with Squid, I set the minimum processor state to 70% and maximum to 99%. The reason to use 70% is that I don't want the CPU to run all the time in TurboBoost mode. When I need long battery life for my Surface I have a another power profile with minimum processor state set to 5% and maximum to 30%. The downside with the way Microsoft implements the manipulation of CPU speed is that it is not possible to have your CPU run at 100% workload with a clock speed of 1 GHz. Instead Microsoft power options will throttle clock speed AND the maximum amount of CPU time used at reduced clock speed. This is the difference to the way CPU speed can be reduced/increased under Linux as just mentioned.
E.g. if you set a processor state of 50% and the CPU runs only at 1.6 GHz of a 3.2 GHz CPU then you are actually only using 50% CPU time of a CPU that is running at 50% maximum CPU speed, hence you are using 25% CPU power compared to a CPU running 100% at 3.2 GHz speed. This is something to keep in mind, since low % values can make your computer really slower.