Linux中关于CPU的一些说明
摘要
如何查看有几个处理器,是否多核?是否超线程?
逻辑CPU个数
cat /proc/cpuinfo | grep "processor" | wc -l
物理CPU个数
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
“siblings”指的是一个物理CPU有几个逻辑CPU。
”cpu cores“指的是一个物理CPU有几个核。
不应该按照flags里是否有ht标志来判断系统是否有超线程能力,而应该:
* 如果“siblings”和“cpu cores”一致,则说明不支持超线程,或者超线程未打开。
* 如果“siblings”是“cpu cores”的两倍,则说明支持超线程,并且超线程已打开。
举例说明
两个双核超线程CPU:
processor 0 1 2 3 4 5 6 7 physical id 0 0 0 0 1 1 1 1 siblings 4 4 4 4 4 4 4 4 core id 0 0 1 1 0 0 1 1 cpu cores 2 2 2 2 2 2 2 2
感谢老男赐予的知识。
转载请注明来源: codante – Linux中关于CPU的一些说明
本文链接地址: http://codante.org/information-on-the-processor-linux
上一篇:
磁盘阵列 – RAID详解
最新评论