How to enable/disable cpu cores in Linux

Spread the love

In Linux for decrease power consumption, you can disable CPU cores. Especially it’s relevant for small computers such as RaspberryPi/OrangePi/NanoPi and similar. For disabling CPU cores run next command in the console:

echo 0 > /sys/devices/system/cpu/cpu{core}/online where {core} is a number of CPU core.

Example:
echo 0 > /sys/devices/system/cpu/cpu1/online

echo 0 > /sys/devices/system/cpu/cpu2/online

 

For enabling CPU core run  echo 1 > /sys/devices/system/cpu/cpu{core}/online where {core} is a number of CPU core.

Example:

echo 1 > /sys/devices/system/cpu/cpu1/online

echo 1 > /sys/devices/system/cpu/cpu2/online

Leave a Reply