首页 > 代码库 > disable cpu
disable cpu
根据我现在的判断,disable cpu 有两种方式。
第一种,在root的时候,进行 disable
Choose ‘e‘ and you get to a command line where you can add options. You can also create permanent boot option in grub by making a copy of your current boot option and add maxcpus=1 to the boot parameters. You can name this ‘Ubuntu, kernel 2.5.12-9-386 (1 cpu)‘ and have it amongst the other boot options like the picture shows. You can verify running on 1 cpu by issuing: cat /proc/cpuinfo | grep processor this should show something like this:
第二种,进行 Hotplug
You can dynamically disable CPUs via /sys/devices/system/cpu/cpuN/online, for example to disable CPU 1, use: echo 0 | sudo tee /sys/devices/system/cpu/cpu1/online
cat /sys/devices/system/cpu/online (to check online cpu)
cat /sys/devices/system/cpu/offline (to check offline cpu)
re-enable, use: echo 1 | sudo tee /sys/devices/system/cpu/cpu1/online
见网页:http://askubuntu.com/questions/46011/is-it-possible-to-disable-a-cpu-not-a-core
https://www.cyberciti.biz/faq/debian-rhel-centos-redhat-suse-hotplug-cpu/
tee 是需要有sudo 权限才能运行的。
disable cpu
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。