Linux view the number of physical CPUs, the number of cores, the number of logical CPUs

Source: Internet
Author: User

(i) Conceptual

① Physical CPU

Number of CPUs on slots in actual server
Number of physical CPUs, several physical IDs can be counted

② Logical CPU

/proc/cpuinfo used to store CPU hardware information.
The information content lists the specification of processor 0–processor N respectively. Note here that n is the logical number of CPUs
In general, we think that a CPU can have multi-core, plus Intel's Hyper-Threading Technology (HT), which can logically be divided into a second number of CPU core out
Logical CPUs = number of physical CPUs x CPU cores This metric value x 2 (if HT is supported and turned on)
Note: Linux top view CPU is also the number of logical CPUs

③CPU Nuclear number

The number of chipsets that can process data on a single CPU, such as the current i5 760, is a dual-core four-thread CPU, and i5 2250 is a quad-core four-threaded CPU
In general, the number of physical CPUs x per kernel should equal the number of logical CPUs, if not equal, the server's CPU support Hyper-Threading Technology

㈡ View CPU Information

When we cat/proc/cpuinfo,
CPUs with the same core ID are the same core Hyper-threading
CPUs with the same physical ID are threads or cores encapsulated by the same CPU

Example

# Total Kernel = number of physical CPUs X number of cores per physical CPU
# Total Logical CPUs = number of physical CPUs x number of cores per physical CPU x Hyper-Threading

# View the number of physical CPUs
cat/proc/cpuinfo| grep "Physical ID" | Sort| uniq| Wc-l

# View the number of cores in each physical CPU (that is, the kernel number)
cat/proc/cpuinfo| grep "CPU Cores" | Uniq

# View the number of logical CPUs
cat/proc/cpuinfo| grep "Processor" | Wc-l

#查看CPU信息 (model)
Cat/proc/cpuinfo | grep name | Cut-f2-d: | Uniq-c

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.