(no subject)
Apr. 1st, 2009 09:48 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Red 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! =;)
no subject
Date: 2009-04-01 09:56 pm (UTC)It was a visual representation of the 2 CPU system, and allowed you to click on each of the CPUs and select to turn them on or off.
However, if you clicked one then the other, it didn't swap the CPUs, it just shut both off. Which is an amusing way to halt your machine.
(OTOH, it wasn't that big a deal if you didn't lose data, as boot time was <30 seconds. Yay OSes that don't believe in splash screens as an OS shouldn't take long enough to boot to need one.)
no subject
Date: 2009-04-01 10:01 pm (UTC)I've heard that the next version of Fedora is going to have crazy-short boot times as well. Looking forward to seeing that.
no subject
Date: 2009-04-01 10:11 pm (UTC)It was a good platform for developing ideas. I just wish they went mainstream faster.