(no subject)
Apr. 1st, 2009 09:48 amRed Hat sends out a monthly training newsletter, one of the more popular features of which is a "tips and tricks" section, to which I've contributed a couple of times. The one that went out this month is something I had no idea about, and is one of those things that makes me geeksquee enough that I feel the need to share, despite the fact that I will probably never need to use it, it's just cool.
---------------------------------------------------------------------------------
Q. Can I "hotplug" a CPU on a running Red Hat Enterprise Linux 5 system?
Red Hat Enterprise Linux 5 supports the cpu-hotplug mechanism, which allows for CPUs to be dynamically disabled and re-enabled on a system without requiring a system reboot.
In order to disable a CPU core in a running machine, use the file /sys/devices/system/cpu/cpuX/online.
The following command will disable a CPU:
# echo 0 > /sys/devices/system/cpu/cpuX/online
Where X is the ID of the CPU as determined from /proc/cpuinfo.
To re-enable the CPU, run:
# echo 1 > /sys/devices/system/cpu/cpuX/online
Check an example and more on this topic at the Red Hat knowledgebase.
---------------------------------------------------------------------------------
And now to spend the rest of the day resisting the urge to try this on my uniprocessor laptop...
Linux (or, to be fair, any OS) is like chess: you never know everything about it.
Edit: Oh, right, my laptop actually has two processors. Sadly the primary processory doesn't have an online file with which to disable it. Stupid sensible design. *nix is supposed to trust/hate me enough to let me screw myself over by doing braindead things if I want to! =;)
---------------------------------------------------------------------------------
Q. Can I "hotplug" a CPU on a running Red Hat Enterprise Linux 5 system?
Red Hat Enterprise Linux 5 supports the cpu-hotplug mechanism, which allows for CPUs to be dynamically disabled and re-enabled on a system without requiring a system reboot.
In order to disable a CPU core in a running machine, use the file /sys/devices/system/cpu/cpuX/online.
The following command will disable a CPU:
# echo 0 > /sys/devices/system/cpu/cpuX/online
Where X is the ID of the CPU as determined from /proc/cpuinfo.
To re-enable the CPU, run:
# echo 1 > /sys/devices/system/cpu/cpuX/online
Check an example and more on this topic at the Red Hat knowledgebase.
---------------------------------------------------------------------------------
And now to spend the rest of the day resisting the urge to try this on my uniprocessor laptop...
Linux (or, to be fair, any OS) is like chess: you never know everything about it.
Edit: Oh, right, my laptop actually has two processors. Sadly the primary processory doesn't have an online file with which to disable it. Stupid sensible design. *nix is supposed to trust/hate me enough to let me screw myself over by doing braindead things if I want to! =;)