程式扎記: [Linux 文章收集] Linux: Find Number of CPU Cores Command

標籤

2015年7月1日 星期三

[Linux 文章收集] Linux: Find Number of CPU Cores Command

Preface 
How do I find out the number of CPU cores available under HP x86_64 Linux serer running on RHEL / Debian Linux 6.x? 

You can use the lscpu or nproc command to display the number of processing units available to the current process, which may be less than the number of online processors (please note that not all server supports hotplug a CPU on a running Linux system). 

The proc file system is a pseudo-file system which is used as an interface to kernel data structures. It is commonly mounted at /proc. The /proc/cpuinfo file is nothing but a collection of CPU and system architecture dependent items, for each supported architecture a different list. Two common entries are processor which gives CPU number and bogomips; a system constant that is calculated during kernel initialization. SMP machines have information for each CPU. 

nproc Example 
The nproc command shows the number of processing units available: 
# nproc
4

lscpu Command 
lscpu gathers CPU architecture information form /proc/cpuinfo in human-read-able format: 
# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 2
NUMA node(s): 1

Vendor ID: GenuineIntel
CPU family: 6
Model: 69
Model name: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
Stepping: 1
CPU MHz: 2294.688
BogoMIPS: 4589.37
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3

/proc/cpuinfo 
The /proc/cpuinfo and sysfs stores info about your CPU architecture ike number of CPUs, threads, cores, sockets, NUMA nodes, information about CPU caches, CPU family, model, bogoMIPS, yte order and much more: 
# less /proc/cpuinfo


Check out related media 
Here is a quick demo of lscpu and /proc/cpuinfo commands: 

沒有留言:

張貼留言

網誌存檔

關於我自己

我的相片
Where there is a will, there is a way!