查看CPU和系统内核的位数

1. 查看CPU的位数

在linux平台, 可以使用uname查询CPU是64位(x86_64)还是32位(i686):

ubuntu 10.4.1 linux $ uname -m
 i686
suse 11 linux $ uname -m
 x86_64
redhat 6.2 linux $ name -m
 x86_64
aix 6.1 unix $ uname -m
 00008EBDD600
sunos 5.10 unix $ uname -m
 sun4v

在linux平台, 或者使用命令'grep flags /proc/cpuinfo', 会出现"tm(transparent mode)", "rm(real mode)"或"lm(long mode)"中的一个, 分别表示16位, 32位, 64位.(不知道为什么, ubuntu中没有)

ubuntu 10.4.1 linux $ grep flags /proc/cpuinfo
 flags        : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss nx rdtscp constant_tsc up arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 sse4_1 sse4_2 popcnt aes xsave avx hypervisor ida arat
suse 11 linux $ grep flags /proc/cpuinfo
 flags           : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm up rep_good pni cx16 popcnt hypervisor lahf_lm
redhat 6.2 linux $ grep flags /proc/cpuinfo
 flags           : fpu de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 ht syscall nx lm rep_good unfair_spinlock pni cx16 popcnt hypervisor lahf_lm
aix 6.1 unix $ uname grep flags /proc/cpuinfo
 grep: can't open /proc/cpuinfo
sunos 5.10 unix $ grep flags /proc/cpuinfo
 grep: can't open /proc/cpuinfo

2. 查看系统内核的位数

使用命令:'getconf LONG_BIT'.

ubuntu 10.4.1 linux $ getconf LONG_BIT
 32
suse 11 linux $ getconf LONG_BIT
 64
redhat 6.2 linux $ getconf LONG_BIT
 64
aix 6.1 unix $ getconf LONG_BIT
 32
sunos 5.10 unix $ getconf LONG_BIT
 32
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值