这是nproc
vsnproc --all
和互联网上找到的其他命令的输出。我还是不明白为什么。它是一个 QEMU\KVM VM,运行 CentOS 6.5 和其他 CentOS 6.5。
以下是其他一些命令的输出:
[root@h1-nms ~]# nproc
1
[root@h1-nms ~]# nproc --all
3
[root@h1-nms ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 3
On-line CPU(s) list: 0-2
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 3
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 13
Stepping: 3
CPU MHz: 2194.710
BogoMIPS: 4389.42
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0-2
[root@h1-nms ~]# getconf _NPROCESSORS_ONLN
3
[root@h1-nms ~]# cat /proc/$$/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 10485760 unlimited bytes
Max core file size unlimited unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 32000 32000 processes
Max open files 64000 64000 files
Max locked memory 65536000 65536000 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 191509 191509 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
[root@h1-nms ~]# grep "" /sys/devices/system/cpu/cpu*/online
/sys/devices/system/cpu/cpu1/online:1
/sys/devices/system/cpu/cpu2/online:1
[root@h1-nms ~]# uname -a
Linux h1-nms 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@h1-nms ~]# cat /etc/*-release
CentOS release 6.5 (Final)
CentOS release 6.5 (Final)
CentOS release 6.5 (Final)
[root@h1-nms ~]#
答案1
答案2
从手册顶部nproc
:
打印当前进程可用的处理单元的数量,该数量可能小于在线处理器的数量。
然后
--all
打印已安装处理器的数量
GNU 信息文档说了更多一点:
打印当前进程可用的处理单元的数量,该数量可能小于在线处理器的数量。如果无法访问此信息,则打印已安装的处理器的数量。如果设置了
OMP_NUM_THREADS
或OMP_THREAD_LIMIT
环境变量,那么它们将分别确定最小和最大返回值。结果保证大于零。
和
--all
打印系统上已安装处理器的数量,该数量可能大于在线数量或当前进程可用的数量。在这种情况下,不遵守
OMP_NUM_THREADS
或环境变量。OMP_THREAD_LIMIT