Monthly Archives: June 2010

Linux cpu count, cores & threads

To identify the number of physical cpu’s you have on a server you can execute the command

-bash-3.2$ grep ‘physical id’ /proc/cpuinfo | sort -u
physical id : 0
physical id : 1

This means you have 2 cpu’s (You can add a | wc -l to the previous command to just get the count)

To identify the number of cores per cpu you can execute the command

-bash-3.2$ grep ‘cores’ /proc/cpuinfo | sort -u

cpu cores : 4

To check if hyperthreading is turned on in the bios

-bash-3.2$ egrep ‘cores|siblings’  /proc/cpuinfo | sort -u
siblings : 8
cpu cores : 4

If cpu cores equal the number of siblings then hyperthreading is off. If siblings is a multiple of cores then hyperthreading is turned on.

If you want to see the number of cpu’s being seen by the operating systems then you can

grep ‘processor’ /proc/cpuinfo | wc -l

or

run the top command and once the output display’s you can just press the 1 key and it will show the utilization for each cpu on the top.