码迷,mamicode.com
首页 > 其他好文 > 详细

disable cpu

时间:2016-12-08 02:24:34      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:amp   devices   man   grub   span   div   pre   options   pos   

根据我现在的判断,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

标签:amp   devices   man   grub   span   div   pre   options   pos   

原文地址:http://www.cnblogs.com/xingzifei/p/6143329.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!