LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 08-18-2009, 01:16 PM   #1
manoj.linux
Member
 
Registered: Aug 2007
Posts: 277

Rep: Reputation: 17
Question finding cpu core information in redhat Linux


Hi,

I want to know how to find out no of cores in linux.

I have given the command more /proc/cpuinfo

NOw I want to know what is diffrence between cpu cores and core id?

How to find out exact no of cores?

Regards,

Manoj
 
Old 08-18-2009, 02:27 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,492
Blog Entries: 15

Rep: Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463
You could do the following:

Code:
egrep "^processor|^cpu cores|^core id" /proc/cpuinfo
This should output something like this:
processor : 0
core id : 0
cpu cores : 2
processor : 1
core id : 0
cpu cores : 2
processor : 2
core id : 0
cpu cores : 2
processor : 3
core id : 0
cpu cores : 2
processor : 4
core id : 1
cpu cores : 2
processor : 5
core id : 1
cpu cores : 2
processor : 6
core id : 1
cpu cores : 2
processor : 7
core id : 1
cpu cores : 2

The processor number is an increment of the total number of cores on the system - since I have 0 through 7 it tells me I have 8 cores.

Since the cpu cores tells me I have 2 I know each of my processors is actually dual core. Unfortunately the second core of each processor shows up as if it were a new processor (that is to say core ID 1 on each of processor's 4 through 7 are actually the second cores on each of processor's 0 through 3 (which each show core ID 0).

All of this lets me know I have 4 dual core processors for a total of 8 cores.

By the way dmidecode command will give you a lot more information about things. If in doubt you can always search for the processor model at the vendor's site to see what its specs are.
 
Old 05-14-2010, 04:12 AM   #3
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Why there is no "Core Id" in my /proc/cpuinfo

Dear All,

I checked two of the Linux Machines and in both of them "core id" is missing from /proc/cpuinfo.
Any idea, why is it so ? Any alternative to find "core id"

Please see the below logs
Code:
-sh-3.00$ cat /etc/redhat-release 
Red Hat Enterprise Linux ES release 4 (Nahant Update 6)
-sh-3.00$ 
-sh-3.00$ egrep "^processor|^cpu cores|^core id" /proc/cpuinfo
processor    : 0
processor    : 1
-sh-3.00$
AND

Code:
[root@server ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5 (Tikanga)
[root@server ~]#
[root@server ~]# egrep "^processor|^cpu cores|^core id" /proc/cpuinfo
processor       : 0
[root@server ~]#
 
Old 05-14-2010, 07:42 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,492
Blog Entries: 15

Rep: Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463Reputation: 1463
If they are single core CPUs then you wouldn't see core ID for them as there is no need to differentiate.

For example I have an older Dell PE 2450 with two single core processors that shows:
egrep "^processor|^cpu cores|^core id" /proc/cpuinfo
processor : 0
processor : 1

Whereas on a newer much larger server with several multicore CPUs I see:
egrep "^processor|^cpu cores|^core id" /proc/cpuinfo
processor : 0
core id : 0
cpu cores : 4
processor : 1
core id : 0
cpu cores : 4
processor : 2
core id : 1
cpu cores : 4
processor : 3
core id : 1
cpu cores : 4
processor : 4
core id : 2
cpu cores : 4
processor : 5
core id : 2
cpu cores : 4
processor : 6
core id : 3
cpu cores : 4
processor : 7
core id : 3
cpu cores : 4
processor : 8
core id : 0
cpu cores : 4
processor : 9
core id : 0
cpu cores : 4
processor : 10
core id : 1
cpu cores : 4
processor : 11
core id : 1
cpu cores : 4
processor : 12
core id : 2
cpu cores : 4
processor : 13
core id : 2
cpu cores : 4
processor : 14
core id : 3
cpu cores : 4
processor : 15
core id : 3
cpu cores : 4

Also after my post last year I've since found the reason for additional CPUs being reported on some servers is due to hyperthreading being enabled. When it is you'll see twice as many processors as you actually have.

As mentioned previously if you use dmidecode to get exact CPU info you may be able to determine from manufacturer's web site what the characteristics (number of cores etc...) are for that model. However, I have noticed Intel seems to have removed a lot of info on older processors.

Last edited by MensaWater; 05-14-2010 at 07:49 AM.
 
1 members found this post helpful.
Old 05-14-2010, 08:29 AM   #5
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Thanks for the valuable information MensaWater.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get cpu information on Linux machine laxmi_cs Programming 41 03-05-2013 02:55 AM
How to get CPU socket and core information? manoj.linux AIX 1 03-07-2009 01:39 AM
LXer: Getting CPU Information From Various Flavours Of Linux And Unix LXer Syndicated Linux News 0 11-13-2008 10:30 AM
How to find out the CPU and OS information on linux? yupeng Linux - General 3 05-25-2008 11:39 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 07:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration