Limit maximum processor speed

cpu

For a long time I wondered why my computer overheated in Linux, although it also happened to me in Windows but not so often, so I wondered what would happen and I realized that it only happened when either of the 2 processors was at 100% frequency by a prolonged time which caused it to overheat and eventually shut down.

This made it almost impossible to install any linux distro since from the live cd they made to put the processor to maximum and I had to put a fan in the ventilation inlet of the laptop, I did this several times because of my mania of installing which distro I was put it in front only until entering the section but only gnome 2 could limit the frequency of the processor (in userspace mode) with the applet that was included but it stayed all the time in the frequency that I put it and it was not in ondemand and that It made it always be at the frequency that I let it and not the one that the processor needed.

It was when I was looking for how to limit the maximum frequency at which the processor can work, so that the processor would be handled in ondemand without reaching 100% of the processor so that it did not overheat.

First we must know how many processors we have in a terminal write:

ls / sys / devices / system / cpu / | grep cpu [0-9]

In my case the output was

cpu0 cpu1

It means I have 2 processors

Then for each processor you have

more / sys / devices / system / cpu / cpu [0-9] / cpufreq / scaling_available_frequencies

In my case the outputs were

:::::::::::::: / sys / devices / system / cpu / cpu0 / cpufreq / scaling_available_frequencies :::::::::::::: 2100000 1050000 525000 --More-- (Next file: / sys / devices / system / cpu / cpu1 / cpufreq / scaling_availabl :::::::::::::: / sys / devices / system / cpu / cpu1 / cpufreq / scaling_available_frequencies :::: :::::::::: 2100000 1050000 525000

For both processors, as I told you if I have the processors at 2100000 hertz it overheats after a while so I want to limit the maximum frequency, as the files in the directory / sys / devices / system / cpu / cpux / cpufreq / are from the administrator is necessary to make the changes we want as administrator

The maximum speed is edited in the file

/ sys / devices / system / cpu / cpu0 / cpufreq / scaling_max_freq / sys / devices / system / cpu / cpu1 / cpufreq / scaling_max_freq

And since I want to change it at each start, it is convenient for me to put it in /etc/rc.local then I edit that file as administrator
Gnome

gksu gedit /etc/rc.local

KDE

kdesu kate /etc/rc.local

Terminal (change nano to your favorite editor or use su before typing the command)

sudo nano /etc/rc.local

Add between the lines

 #! / bin / sh -e echo 1050000> '/ sys / devices / system / cpu / cpu0 / cpufreq / scaling_max_freq' echo 1050000> '/ sys / devices / system / cpu / cpu1 / cpufreq / scaling_max_freq' exit 0

And so the maximum speed of the processor will be 1050000.

I hope it is useful to someone.


Add as preferred source in Google