LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-08-2011, 10:26 PM   #1
Richard.Yang
Member
 
Registered: Sep 2008
Posts: 106

Rep: Reputation: 16
How to view whether I have 4 cpu or one cpu with 4 core?


This sounds a silly question.
And I am counfused about the "cpu cores" in the output result.

I do cat /proc/cpuinfo and shows:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz
stepping : 7
cpu MHz : 800.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 5184.06
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz
stepping : 7
cpu MHz : 800.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 1
initial apicid : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 5182.96
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz
stepping : 7
cpu MHz : 800.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 2
initial apicid : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 5182.97
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz
stepping : 7
cpu MHz : 2601.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 3
initial apicid : 3
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 5182.98
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
 
Old 08-09-2011, 12:40 AM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
what is it you are confused about ?
you have an i5
a 4 core cpu

http://www.intel.com/content/www/us/...processor.html
 
Old 08-09-2011, 01:09 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by John VV View Post
what is it you are confused about ?
you have an i5
a 4 core cpu

http://www.intel.com/content/www/us/...processor.html
To be more precise, your i5 is a 4 core version (there are 2 core versions of the i5) with Hyper-Threading support, so you have 4 physical but 8 logical cores.
 
Old 08-09-2011, 01:10 AM   #4
kasl33
Member
 
Registered: Oct 2004
Location: USA
Distribution: Ubuntu-Server, Mac OS X, Arch Linux
Posts: 356

Rep: Reputation: 48
it appears as if you have a quad-core with four virtual cores.
 
Old 08-09-2011, 01:30 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Quote:
Originally Posted by TobiSGD View Post
To be more precise, your i5 is a 4 core version (there are 2 core versions of the i5) with Hyper-Threading support, so you have 4 physical but 8 logical cores.
Shouldn't that be: 1 physical cpu, 2 physical cores and 4 logical cores?

If I run the following command on the cpuinfo provided I see:
Code:
cat cpuinfo_file | egrep "physical id|siblings|core id|cpu cores|^$" 
physical id : 0
siblings : 4
core id : 0
cpu cores : 2

physical id : 0
siblings : 4
core id : 0
cpu cores : 2

physical id : 0
siblings : 4
core id : 1
cpu cores : 2

physical id : 0
siblings : 4
core id : 1
cpu cores : 2
 
1 members found this post helpful.
Old 08-09-2011, 04:30 AM   #6
Richard.Yang
Member
 
Registered: Sep 2008
Posts: 106

Original Poster
Rep: Reputation: 16
more confused, physical core and virtual core?
what is the difference
 
Old 08-09-2011, 04:51 AM   #7
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,753

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
i5-2540M, thats a mobile CPU. I've never even heard of a laptop with 2 physical CPUs, let alone 4.....

Quote:
Originally Posted by John VV View Post
what is it you are confused about ?
you have an i5
a 4 core cpu

http://www.intel.com/content/www/us/...processor.html
Not all i5s are quad core. See here-

http://en.wikipedia.org/wiki/List_of...icroprocessors

Quote:
Originally Posted by TobiSGD View Post
To be more precise, your i5 is a 4 core version (there are 2 core versions of the i5) with Hyper-Threading support, so you have 4 physical but 8 logical cores.
Nope, its a dual-core version-

Quote:
Processor Number i5-2540M
# of Cores 2
# of Threads 4
http://ark.intel.com/products/50072

*edit- all the released 'sandy bridge' i5 mobile CPUs (i5-2XXXM) are dual core.

Quote:
Originally Posted by druuna View Post
Hi,

Shouldn't that be: 1 physical cpu, 2 physical cores and 4 logical cores?

If I run the following command on the cpuinfo provided I see:
Code:
cat cpuinfo_file | egrep "physical id|siblings|core id|cpu cores|^$" 
physical id : 0
siblings : 4
core id : 0
cpu cores : 2

physical id : 0
siblings : 4
core id : 0
cpu cores : 2

physical id : 0
siblings : 4
core id : 1
cpu cores : 2

physical id : 0
siblings : 4
core id : 1
cpu cores : 2
Yeah, thats right. Not that your cpuinfo matters unless you've got the same CPU.

Quote:
Originally Posted by Richard.Yang View Post
more confused, physical core and virtual core?
what is the difference
'Virtual' cores just 'look' to the OS as though there are 2 cores when there is only 1 real core. Its technically trickey, that really doesnt matter much at all for real world tasks. Having 4 virtual cores in most cases will not give any real advatange over 2 physical cores.

Last edited by cascade9; 08-09-2011 at 04:53 AM.
 
1 members found this post helpful.
Old 08-09-2011, 05:38 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by cascade9 View Post
Yeah, thats right. Not that your cpuinfo matters unless you've got the same CPU.
It is not my cpuinfo it is the OP's info, as stated in my reply
 
Old 08-09-2011, 08:13 AM   #9
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,753

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
Quote:
Originally Posted by druuna View Post
Hi,
It is not my cpuinfo it is the OP's info, as stated in my reply
I dont know how you did that then.

I'd assume that you wrote Richard.Yangs CPUinfo into a file, then ran your command against that?

Not that its something I could see myself doing, I find it much easier to get the specs from the CPU model number. Remembering commands isnt my strong point, and even if I do remember things like that I'm bound to typo the command (mild dyslexia, though it only seems to affect my speeling LOL).
 
Old 08-09-2011, 10:26 AM   #10
Richard.Yang
Member
 
Registered: Sep 2008
Posts: 106

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by cascade9 View Post
I dont know how you did that then.

I'd assume that you wrote Richard.Yangs CPUinfo into a file, then ran your command against that?

Not that its something I could see myself doing, I find it much easier to get the specs from the CPU model number. Remembering commands isnt my strong point, and even if I do remember things like that I'm bound to typo the command (mild dyslexia, though it only seems to affect my speeling LOL).
Hi, cascade9

In your previous post, you mean my cpu has two physical cores.
You get this result for the core id in the /proc/cpuinfo?
Since there is only two core id in this file?

BTW, you also mentioned the 4 logical core have no advantage to 2 physical core.
Do you have any proof? or statistics? you have seen at other place?
If it is true, why intel invent logical core?
 
Old 08-09-2011, 10:59 AM   #11
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,753

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
I got that from intel.

Its sure possible to get that sort of info from commands, druuna did. I just find it a lot easier to get the technical details from intel.

Hyperthreading goes back to the P4s. I have never quite got why intel made hyperthreading, though I do know at the time of release the P4 hyperthreading CPUs were very popular with people doing distributed computing (eg folding at home) becuase you could run 2 projects at once.

Hyperthreading does tend to give better results with artifical benchmarks, which could be part of why they did it. Due to people who only looked at 3dmark results, or sandra results, not 'real world' results. You can see that here-

http://www.overclock.net/intel-cpus/...e-scaling.html

3Dmark2011 gets better results with hyperthreading on, but the 'real world' framerates are typcially lower with hyperthreading off. Not a huge difference though (check the scale on the graphs, the graphics are misleading)

As for how much hyperthreading helps (or hurts in some cases) that depends on what you are look at.

I could probably dig up a few hundred hyperthreading enchmarks if you really want. I'll try to track down the hyperthreading/non-hyperthreading comparison I've seen using non-gaming benchmarks.
 
1 members found this post helpful.
Old 08-10-2011, 06:12 AM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by druuna View Post
Hi,

Shouldn't that be: 1 physical cpu, 2 physical cores and 4 logical cores?

If I run the following command on the cpuinfo provided I see:
Code:
cat cpuinfo_file | egrep "physical id|siblings|core id|cpu cores|^$" 
physical id : 0
siblings : 4
core id : 0
cpu cores : 2

physical id : 0
siblings : 4
core id : 0
cpu cores : 2

physical id : 0
siblings : 4
core id : 1
cpu cores : 2

physical id : 0
siblings : 4
core id : 1
cpu cores : 2
You are right, it is a dual core CPU, not a quad core CPU. I shouldn't post when tired.
 
Old 08-10-2011, 08:21 AM   #13
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Richard.Yang View Post
BTW, you also mentioned the 4 logical core have no advantage to 2 physical core.
Do you have any proof? or statistics? you have seen at other place?
If it is true, why intel invent logical core?
I expect it is hard to do a meaningful performance comparison. The results would depend heavily on details of configuration and workload.

I haven't done a controlled comparison of performance with/without hyperthreading in many years. Then my only moderately meaningful comparison was for running multiple compiles in parallel on Windows and hyperthreading helped significantly. Where I work, I still spend a lot of time waiting for compiles (now for example), but now I'm stuck (company policy) with stupid anti-virus software that randomly slows everything down by two to ten times. I can run 8 compiles in parallel with my 8 cores or turn on hyperthreading and run 16 compiles in parallel. Either way, every compiler process spends almost all its time waiting for the anti-virus to allow it to read files. The physical or logical cores are almost completely idle all the time. I can't meaningfully compare with/without hyperthreading because performance varies dramatically at random.

Based on theory, not current testing, I think there was more reason for hyperthreading when it was invented than there is now:

1) With one core, a networked GUI workstation can feel very non responsive. With a coarse time slicing value, mouse clicks and network packets have significant latency before they are serviced. With a smaller time slice value, the system wastes lots of CPU time with excess context switching. A second virtual core can make the system feel a lot more responsive even if the processing throughput is no higher. But the big responsiveness difference is only between 1 logical core and two, not between two and four. So with two physical cores turning on hyperthreading won't significantly change the responsiveness of most systems.

2) The Intel 32 bit architecture is short of registers, often causing compilers to generate code that has very poor utilization of CPU resources. Hyperthreading allows two logical cores to share the resources of one physical core. When the generated code makes poor use of CPU resources that sharing allows more total processing to get done per second. But now many people are using 64 bit applications instead of 32 bit. It is easier for compilers to generate good code for the 64 bit architecture. So programs should be making better use of CPU resources, so the sharing resources between logical cores would more often be competing for resources.
 
1 members found this post helpful.
Old 08-12-2011, 01:29 AM   #14
Richard.Yang
Member
 
Registered: Sep 2008
Posts: 106

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by johnsfine View Post
I expect it is hard to do a meaningful performance comparison. The results would depend heavily on details of configuration and workload.

I haven't done a controlled comparison of performance with/without hyperthreading in many years. Then my only moderately meaningful comparison was for running multiple compiles in parallel on Windows and hyperthreading helped significantly. Where I work, I still spend a lot of time waiting for compiles (now for example), but now I'm stuck (company policy) with stupid anti-virus software that randomly slows everything down by two to ten times. I can run 8 compiles in parallel with my 8 cores or turn on hyperthreading and run 16 compiles in parallel. Either way, every compiler process spends almost all its time waiting for the anti-virus to allow it to read files. The physical or logical cores are almost completely idle all the time. I can't meaningfully compare with/without hyperthreading because performance varies dramatically at random.

Based on theory, not current testing, I think there was more reason for hyperthreading when it was invented than there is now:

1) With one core, a networked GUI workstation can feel very non responsive. With a coarse time slicing value, mouse clicks and network packets have significant latency before they are serviced. With a smaller time slice value, the system wastes lots of CPU time with excess context switching. A second virtual core can make the system feel a lot more responsive even if the processing throughput is no higher. But the big responsiveness difference is only between 1 logical core and two, not between two and four. So with two physical cores turning on hyperthreading won't significantly change the responsiveness of most systems.

2) The Intel 32 bit architecture is short of registers, often causing compilers to generate code that has very poor utilization of CPU resources. Hyperthreading allows two logical cores to share the resources of one physical core. When the generated code makes poor use of CPU resources that sharing allows more total processing to get done per second. But now many people are using 64 bit applications instead of 32 bit. It is easier for compilers to generate good code for the 64 bit architecture. So programs should be making better use of CPU resources, so the sharing resources between logical cores would more often be competing for resources.
The two reason is interesting. Thanks.
 
Old 08-12-2011, 04:13 PM   #15
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
In all of this, it basically makes no difference. Some programs will benefit from the cores while others will not. Some work better on hyperthreads and others go slower.

In tests you sometimes see dual core system stomp quad cores just because the clock speed is higher in the dual core.
 
  


Reply



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
why does SCHED_FIFO task on one CPU affects other CPU tasks on a multy core system? reg13 Linux - Kernel 2 07-31-2011 09:48 PM
Cpu fan stuck to the cpu, how do I get the cpu out? abefroman Linux - Hardware 16 09-04-2009 12:47 AM
cpu frequency scaling with Pentium(R) Dual-Core CPU E5200 @ 2.50GHz tramni1980 Slackware 5 08-16-2009 08:29 AM
Intel DG33FB motherboard - cannot run second core on cpu (core 2 duo) rmitev Linux - Enterprise 2 09-28-2007 04:54 AM
View CPU Process (1001010110101001) g0kuss4 Linux - General 8 08-24-2003 10:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:43 PM.

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
Open Source Consulting | Domain Registration