共计 2216 个字符,预计需要花费 6 分钟才能阅读完成。
有时候晓得服务器的 CPU 架构为 32 位或 64 位是否十分重要的,因为 64 位应用程序不能在 32 位零碎上运行,而 32 位应用程序能够轻松运行在 64 位零碎。
确定 CPU 是 32 位还是 64 位?
通过查看 /proc/cpuinfo 文件确定 CPU 体系结构,如下所示:
[root@localhost ~]# cat /proc/cpuinfo | grep -i flags
flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc up rep_good pni monitor ssse3 lahf_lm
在下面的输入中,咱们能够看到 lm,tm,rm,这些标记示意 CPU 架构。
含意如下:
- lm : Long Mode (64 bit)
- tm : Transparent Mode (32 bit)
- rm : Real Mode (16 bit)
应用 lscpu 命令查看 CPU 架构,在输入中查找“CPU op-modes(s)”
koogua@debian:~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 48 bits physical, 48 bits virtual
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 25
Model: 80
Model name: AMD Ryzen 5 5600H with Radeon Graphics
Stepping: 0
CPU MHz: 3293.726
BogoMIPS: 6587.45
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32 KiB
L1i cache: 32 KiB
L2 cache: 512 KiB
L3 cache: 16 MiB
应用 lshw –class processor 命令查看 CPU 架构
koogua@debian:~$ sudo lshw -class processor
*-cpu
product: AMD Ryzen 5 5600H with Radeon Graphics
vendor: Advanced Micro Devices [AMD]
physical id: 2
bus info: cpu@0
width: 64 bits
capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp x86-64 constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes rdrand hypervisor lahf_lm cr8_legacy abm sse4a misalignsse 3dnowprefetch vmmcall fsgsbase bmi1 bmi2 invpcid rdseed clflushopt arat
应用 dmidecode 命令查看 CPU 体系结构
[root@localhost ~]# dmidecode -t processor
确定 Linux 是 32 位还是 64 位?
能够应用 lscpu,uname,getconf 命令,找到 Linux 零碎是 32 位还是 64 位。
[root@localhost ~]# lscpu
输入如下:
koogua@debian:~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 48 bits physical, 48 bits virtual
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 25
Model: 80
Model name: AMD Ryzen 5 5600H with Radeon Graphics
Stepping: 0
CPU MHz: 3293.726
BogoMIPS: 6587.45
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32 KiB
L1i cache: 32 KiB
L2 cache: 512 KiB
L3 cache: 16 MiB
应用 uname -m 命令,输入如下
[root@localhost ~]# uname -m
x86_64
应用 getconfig 命令,输入如下
[root@localhost ~]# getconf LONG_BIT
64
我的开源我的项目
- course-tencent-cloud(酷瓜云课堂 – gitee 仓库)
- course-tencent-cloud(酷瓜云课堂 – github 仓库)
正文完