Home > Backend Development > PHP Tutorial > Check the number of physical CPUs, cores, and logical CPUs on Linux

Check the number of physical CPUs, cores, and logical CPUs on Linux

WBOY
Release: 2016-07-29 09:08:02
Original
1134 people have browsed it

When learning swoole, it is recommended that the number of worker processes opened is 1-4 times the number of CPU cores. So I learned how to check the number of CPU cores

# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

# 查看每个物理CPU核数
cat /proc/cpuinfo| grep "cpu cores"| uniq

# 查看逻辑CPU个数
cat /proc/cpuinfo| grep "processor"| wc -l<br># 查看CPU信息(型号)<br>cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
Copy after login

The above introduces how to check the number of physical CPUs, cores, and logical CPUs in Linux, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template