怎样识别操作系统和CPU是32为的还是64位的

来源:互联网 发布:ios多线程编程实例 编辑:程序博客网 时间:2024/05/16 12:54
首先说明一下,64位的CPU可以安装64位的操作系统,也可以安装32位的操作系统;
但是32的CPU只能安装32为的操作系统。

 windows版:
使用systeminfo命令查看下列两行就知道操作系统和CPU的位数了

例1:(CPU为:Intel(R) Xeon(TM) CPU 3.06GHz, codenamed "Prestonia")
システムの種類:              X86-based PC  //操作系统是32位的
プロセッサ:                     2 プロセッサインストール済みです。
                                   [01]: x86 Family 15 Model 2 Stepping 9 GenuineIntel //是双核的32位CPU
                                   [02]: x86 Family 15 Model 2 Stepping 9 GenuineIntel

例2:(CPU为:Intel(R) Xeon(TM) CPU 3.00GHz, codenamed "Nocona"),intel在Xeon系列的CPU从这开始支持64位;
システムの種類:              x64-based PC//操作系统是64位的
プロセッサ:                     4 プロセッサインストール済みです。
                                   [01]: EM64T Family 15 Model 4 Stepping 1 GenuineIntel ~2993 Mhz//是四核的64位CPU
                                   [02]: EM64T Family 15 Model 4 Stepping 1 GenuineIntel ~2993 Mhz//但是这里是EM64T,不是正的64位
                                   [03]: EM64T Family 15 Model 4 Stepping 1 GenuineIntel ~2993 Mhz
                                   [04]: EM64T Family 15 Model 4 Stepping 1 GenuineIntel ~2993 Mhz

例3:(CPU为:Intel Core 2 Duo E4500, codenamed "Conroe"),这个CPU是支持EM64T指令集的;但是为什么显示的是32位的CPU,难道和BIOS或者操作系统有关;
システムの種類:         X86-based PC//操作系统是32位的
プロセッサ:                2 プロセッサインストール済みです。
                              [01]: x86 Family 6 Model 15 Stepping 13 GenuineIntel ~2199 Mhz//是双核的32位CPU
                              [02]: x86 Family 6 Model 15 Stepping 13 GenuineIntel ~2199 Mhz

例4:(CPU为:Intel Itanium 2, codenamed "Madison"),这是真正的64位CPU
システムの種類:              Itanium (TM) -based System//操作系统是64位的
プロセッサ:                     1 プロセッサインストール済みです。
                                   [01]: ia64 Family 31 Model 1 Stepping 5 GenuineIntel ~1300 Mhz//是单核的64位CPU

linux版:
使用uname命令就行了;
说明:

If multiple options or -a are given, the selected information isprinted in this order:

     kernel-name nodename kernel-release kernel-version
machine processor hardware-platform operating-system

例1:uname -a
Linux localhost.localdomain 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:39:47 EDT 2008 i686 i686 i386 GNU/Linux
这个是在32位的CPU上安装的32位系统

例2:
Linux localhost.localdomain 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
这个是在EM64T的CPU上安装的EM64T的系统

例3:
Linux localhost.localdomain 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:55 EDT 2007 ia64 ia64 ia64 GNU/Linux
这个是在64位的CPU上安装的64位系统,第一个ia64表示的64位系统,第三个ia64表示的是64位的cpu;
如果你想查看CPU的信息的话,使用 cat /proc/cpuinfo命令就好了;

hp版:
使用的命令是machinfo -v

例1:
CPU info:
  1 PA-RISC 8800 processor (800 MHz, 64 MB)//CPU的类型
          CPU version 5

          Vendor identification:        Hewlett-Packard
          Processor version info:       0x0000000000000285
          Processor capabilities:       0x00000000000000b2
                  FSTWS, FSTWX, FLDWS, FLDWX generate word tx to I/O space
                  Multimedia halfword shift-and-adds
                  Multimedia halfword adds and subtracts
                  Speculative data prefetch on loads of GR0
          Instruction cache:      64 MB
          Data cache:             64 MB

Memory: 1022 MB (1 GB)

Firmware info:
   Firmware revision:  46.34
   IPMI is supported on this system.
   BMC firmware revision: 3.52

Platform info:
   Model:                  "9000/800/rp3410  "
   Machine ID number:      Z3e12d66e30f9f60a
   Machine serial number:  SGH473909C

OS info:
   Nodename:  dd
   Release:   HP-UX B.11.31//操作系统版本
   Version:   U (unlimited-user license)
   Machine:   9000/800
   ID Number: 821687818
   vmunix _release_version:
_release_version:

有了CPU类型就可以在hp的官网上查找CPU的位数了;操作系统也是一样的。
有人说可以使用getconf LONG_BIT和getconf WORD_BIT结合判断,或者使用fiel /bin/ls等,我就不多说了。
原创粉丝点击