毕业也一年多了,虽说也一直在IT行业混,但长挂在嘴边的一句话竟然是:我是打酱油的!实在不想就这么混下去,所以重新申请了一个号,决定从新写博客,这样也能充实自己,找到对生活的乐趣!
既然决定重新开始了,但是从什么地方开始却是是伤脑筋的问题,回想自己这个业余SA一年来的工作经历,似乎了解服务器的信息是干活的第一步,这个还算符合逻辑,那就从硬件开始。Linux下查看CPU的信息当然是查看/proc/cpuinfo这个虚拟文件了。
上图显示的就是/proc/cpuinfo的信息了,CPU嘛,重点了解的就是几颗,几核,是否支持超线程了,那我们要了解这些,就需要查看processor,physical id, siblings,core id,cpu cores这几个字段了,它们分别代表什么,图上已经有注释,所以只需要说明一下判断依据了。
1. 拥有相同physical id的所有逻辑处理器共享同一个物理插座。每个physical id 代表一个唯一的物理封装,即一颗CPU.
2. Siblings表示位于一个物理封装的CPU上逻辑CPU的个数。
3. 每个core id 均代表一个唯一的处理器内核,所有带有相同core id 的逻辑CPU均位于同一处理器内核上。
4. 如果有一个以上逻辑CPU有用相同的core id和physical id ,则说明系统支持超线程(HT)技术。
5. 如果有两个或两个以上的逻辑CPU拥有相同的physical id ,但是core id不同,则说明这是一个多内核处理器,cpu cores字段也可以表示是否支持多内核。
可以通过以下方法查询CPU状态。
1. 逻辑CPU个数:
# cat /proc/cpuinfo | grep “processor” | wc –l
2.物理CPU个数:
# cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc –l
3.每个物理cpu中core的个数:
# cat /proc/cpuinfo | grep “cpu cores” | wc –l
4.是否支持超线程?如果两个逻辑CPU具有相同的“core id”,那么说明超线程是打开的。
5.每个物理CPU中逻辑CPU的个数》
# cat /proc/cpuinfo | grep “siblings”
o processor
— Provides each processor with an identifying number. On systems that have one processor, only a 0
is present.
o cpu family
— Authoritatively identifies the type of processor in the system. For an Intel-based system, place the number in front of "86" to determine the value. This is particularly helpful for those attempting to identify the architecture of an older system such as a 586, 486, or 386. Because some RPM packages are compiled for each of these particular architectures, this value also helps users determine which packages to install.
o model name
— Displays the common name of the processor, including its project name.
o cpu MHz
— Shows the precise speed in megahertz for the processor to the thousandths decimal place.
o cache size
— Displays the amount of level 2 memory cache available to the processor.
o siblings
— Displays the number of sibling CPUs on the same physical CPU for architectures which use hyper-threading.
o flags
— Defines a number of different qualities about the processor, such as the presence of a floating point unit (FPU) and the ability to process MMX instructions.
需要注意的是 physical id 和 core id 不一定连续
重点需要了解:物理CPU,逻辑CPU,超线程。
参考:http://blog.csdn.net/eroswang/archive/2009/04/16/4085310.aspx
https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-proc-cpuinfo.html