How to view whether I have 4 cpu or one cpu with 4 core?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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
*edit- all the released 'sandy bridge' i5 mobile CPUs (i5-2XXXM) are dual core.
Quote:
Originally Posted by druuna
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
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.
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).
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?
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-
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.