Check the number of physical CPUs and the number of logical CPUs in linux.

Source: Internet
Author: User
Linux to view the number of physical cpu and logical number [plain] hadoop @ chw-desktop3 :~ $ Cat/proc/cpuinfoprocessor: 0vendor_id: GenuineIntelcpufamily: 15 model: 2 modelname: Intel (R )... linux to view the number of physical cpu and logical number [plain] hadoop @ chw-desktop3 :~ $ Cat/proc/cpuinfo processor: 0 vendor_id: GenuineIntel cpu family: 15 model: 2 model name: Intel (R) Pentium (R) 4 CPU 3.00 GHz stepping: 9 microcode: 0x17 cpu MHz: 2992.615 cache size: 512 KB physical id: 0 siblings: 2 core id: 0 cpu cores: 1 apicid: 0 initial apicid: 0 fdiv_bug: no hlt_bug: no f00f_bug: no coma_bug: no fpu: yes fpu_exception: yes cpuid level: 2 wp: yes flags: Fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat limit 36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pebs bts cid xtpr bogomips: 5985.23 clflush size: 64 cache_alignment: 128 address sizes: 36 bits physical, 32 bits virtual power management: processor: 1 vendor_id: GenuineIntel cpu family: 15 model: 2 model name: Intel (R) pentium (R) 4 CPU 3.00 GHz stepping: 9 microcode: 0x17 cpu MHz: 2992.615 cache size: 512 KB physical id: 0 siblings: 2 core id: 0 cpu cores: 1 apicid: 1 initial apicid: 1 fdiv_bug: no hlt_bug: no f00f_bug: no coma_bug: no fpu: yes fpu_exception: yes cpuid level: 2 wp: yes flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat limit 36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pebs bts cid xtpr bogomips: 5990.44 Clflush size: 64 cache_alignment: 128 address sizes: 36 bits physical, 32 bits virtual power management: enter the command cat/proc/cpuinfo to view the number of physical IDs. the preceding result shows that only 0 is displayed, therefore, there is only one physical cpu. check whether there are several processor instances. the preceding results show that there are two logical CPUs: 0 and 1. (1) concept ① number of CPUs in the slot of the physical CPU in the actual Server, there are several distinct physical IDs. ② logical CPU/proc/cpuinfo lists the specifications of processor 0-processor n. Note that n is the number of logical CPUs. we think that a cpu can have multiple cores, and intel's Hyper-Threading Technology (HT ), logically, you can repeat the number of cpu cores to obtain logical CPU count = physical cpu count x cpu cores. the specification value is x 2 (if ht is supported and enabled). Note the following: in Linux, the top view CPU is also the number of logical CPUs ③ number of CPU cores the number of chipsets on which data can be processed by one CPU, such as the current i5 760, it is a dual-core CPU with four threads, while i5 2250 is a four-core CPU with four threads. Generally, the number of physical CPUs × the number of each core should be equal to the number of logical CPUs. otherwise, indicates that the CPU of the server supports Hyper-Threading Technology (II) view CPU information. when we use cat/proc/cpuinfo, the CPU with the same core id is the same CPU with the same physical id. threads or cores encapsulated by the same CPU (III) example 1 view the number of physical CPUs # cat/proc/cpuinfo | grep "physical id" | sort | uniq | wc-l 2 (2) view the number of logical CPUs # cat/proc/cpuinfo | grep "processor" | wc-l 24 ③ check the CPU cores # cat/proc/cpuinfo | grep "cores" | uniq 6. I should have two CPUs here, each Cpu has 6 cores, which should be Intel's U and support hyper-threading.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.