linux 系統版本及系統位數

我們可以用/proc/cpuinfo 查看CPU 的信息。 該文件包含系統上每個處理器的數據段落。/proc/cpuinfo 描述中有 6 個條目適用於多內核和超線程(HT技術檢查:processor, vendor id, physical id, siblings, core id 和 cpu cores。

(1)processor:包括這一邏輯處理器的唯一標識符。

(2)physical id :包括每個物理封裝的唯一標識符。

(3)core id :保存每個內核的唯一標識符。

(4)siblings :列出了位於相同物理封裝中的邏輯處理器的數量。

(5)cpu cores :包含位於相同物理封裝中的內核數量。

(6)如果處理器爲英特爾處理器,則 vendor id 條目中的字符串是 GenuineIntel。

 

擁有相同 physical id 的所有邏輯處理器共享同一個物理插座。 每個 physical id 代表一個唯一的物理封裝。Siblings 表示位於這一物理封裝上的邏輯處理器的數量。邏輯處理器可能支持也可能不支持超線程(HT)技術。每個 core id 均代表一個唯一的處理器內核。所有帶有相同 core id 的邏輯處理器均位於同一個處理器內核上。如果有一個以上邏輯處理器擁有相同的 core id  physical id,則說明系統支持超線程(HT)技術。如果有兩個或兩個以上的邏輯處理器擁有相同的 physical id,但是 core id 不同,則說明這是一個多內核處理器。cpu cores 條目也可以表示是否支持多內核。

 

 

一. i386 i586 i686 之間的區別

他們指的是適用於intel i386、 i586、i686 兼容指令集的微處理器。一般來說,等級愈高的機器可接受較低等級的rpm文件。

i386—幾乎所有的X86平臺,不論是舊的pentum或者是新的pentum-IV與K7系統CPU,都可以正常工作,i指得是Intel兼容的CPU,至於386就是CPU的等級。

i586—就是586等級的計算機,包括pentum第一代MMX CPU,AMD的K5,K6系統CPU(socket7插腳)等CPU都是這個等級。

i686—pentum 2 以後的Intel系統CPU及K7以後等級的CPU都屬於這個686等級。
你可以透過/proc/cpuinfo這個檔案查詢你的CPU等級。

 

 

二. 查看CPU 信息

 

我們可以通過/proc/cpuinfo 這個文件來查看CPU 的信息。

 

[root@qs-wgdb-1 proc]# more /proc/cpuinfo

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 6

model           : 44

model name      : Intel(R) Xeon(R) CPU           E5630  @ 2.53GHz

stepping        : 2

cpu MHz         : 2527.071

cache size      : 12288 KB

physical id     : 1

siblings        : 8

core id         : 0

cpu cores       : 4

apicid          : 32

fpu             : yes

fpu_exception   : yes

cpuid level     : 11

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dt

s acpi mmx fxsr sse sse2 ss ht tm syscall nx pdpe1gb rdtscp lm constant_tsc ida nonstop_tsc arat pni

 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm

bogomips        : 5054.14

clflush size    : 64

cache_alignment : 64

address sizes   : 40 bits physical, 48 bits virtual

power management: [8]

 

processor       : 1

vendor_id       : GenuineIntel

cpu family      : 6

model           : 44

model name      : Intel(R) Xeon(R) CPU           E5630  @ 2.53GHz

stepping        : 2

cpu MHz         : 2527.071

cache size      : 12288 KB

physical id     : 0

siblings        : 8

core id         : 0

cpu cores       : 4

apicid          : 0

fpu             : yes

fpu_exception   : yes

cpuid level     : 11

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dt

s acpi mmx fxsr sse sse2 ss ht tm syscall nx pdpe1gb rdtscp lm constant_tsc ida nonstop_tsc arat pni

 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm

bogomips        : 5054.02

clflush size    : 64

cache_alignment : 64

address sizes   : 40 bits physical, 48 bits virtual

power management: [8]

 

processor       : 2

vendor_id       : GenuineIntel

cpu family      : 6

model           : 44

model name      : Intel(R) Xeon(R) CPU           E5630  @ 2.53GHz

stepping        : 2

cpu MHz         : 2527.071

cache size      : 12288 KB

physical id     : 1

siblings        : 8

core id         : 1

cpu cores       : 4

apicid          : 34

fpu             : yes

fpu_exception   : yes

cpuid level     : 11

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dt

s acpi mmx fxsr sse sse2 ss ht tm syscall nx pdpe1gb rdtscp lm constant_tsc ida nonstop_tsc arat pni

 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm

bogomips        : 5054.04

clflush size    : 64

cache_alignment : 64

address sizes   : 40 bits physical, 48 bits virtual

power management: [8]

 

….

 

processor       : 14

vendor_id       : GenuineIntel

cpu family      : 6

model           : 44

model name      : Intel(R) Xeon(R) CPU           E5630  @ 2.53GHz

stepping        : 2

cpu MHz         : 2527.071

cache size      : 12288 KB

physical id     : 1

siblings        : 8

core id         : 10

cpu cores       : 4

apicid          : 53

fpu             : yes

fpu_exception   : yes

cpuid level     : 11

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx pdpe1gb rdtscp lm constant_tsc ida nonstop_tsc arat pni monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm

bogomips        : 5054.03

clflush size    : 64

cache_alignment : 64

address sizes   : 40 bits physical, 48 bits virtual

power management: [8]

 

processor       : 15

vendor_id       : GenuineIntel

cpu family      : 6

model           : 44

model name      : Intel(R) Xeon(R) CPU           E5630  @ 2.53GHz

stepping        : 2

cpu MHz         : 2527.071

cache size      : 12288 KB

physical id     : 0

siblings        : 8

core id         : 10

cpu cores       : 4

apicid          : 21

fpu             : yes

fpu_exception   : yes

cpuid level     : 11

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx pdpe1gb rdtscp lm constant_tsc ida nonstop_tsc arat pni monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm

bogomips        : 5053.98

clflush size    : 64

cache_alignment : 64

address sizes   : 40 bits physical, 48 bits virtual

power management: [8]

 

 

 

三. 相關分析

 

3.1 查看服務器位數

[root@qs-wgdb-1 proc]# arch

x86_64

 

x86_64: 64位系統

X86:32位系統

 

3.2 查看CPU 是否支持64bit

[root@qs-wgdb-1 proc]# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l

16

 

結果大於0, 說明支持64bit計算. lm指long mode, 支持lm則是64bit。

 

3.3 邏輯CPU個數:
[root@qs-wgdb-1 proc]# cat /proc/cpuinfo | grep 'processor' | wc -l

16

 

注意:這裏是邏輯CPU。 就是我們在cpuinfo中看到的processor.

 

 

3.4 物理CPU個數:

[root@qs-wgdb-1 proc]# cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l

2

 

這裏指的是物理CPU,就是我們在服務器上看到的2個CPU 插槽。

 

 

3.5 每個物理CPUCore的個數:
[root@qs-wgdb-1 proc]# cat /proc/cpuinfo | grep 'cpu cores' | wc -l

16

 

3.6 是否爲超線程:

如果有兩個邏輯CPU具有相同的”core id”,那麼超線程是打開的。每個物理CPU中邏輯CPU(可能是core, threads或both)的個數.


[root@qs-wgdb-1 proc]# cat /proc/cpuinfo | grep 'siblings'

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

siblings        : 8

 

 

 

四. CPU ID

 

CPU ID是CPU生產廠家爲識別不同類型的CPU,而爲CPU制訂的不同的單一的代碼;不同廠家的CPU,其CPU ID定義也是不同的;如 “0F24”(Inter處理器)、“681H”(AMD處理器),根據這些數字代碼即可判斷CPU屬於哪種類型,這就是一般意義上的CPU ID。 

由 於計算機使用的是十六進制,因此CPU ID也是以十六進制表示的。Inter處理器的CPU ID一共包含四個數字,如“0F24”,從左至右分別表示 Type(類型)、Family(系列)、Mode(型號)和Stepping(步進編號)。

從CPUID爲“068X”的處理器開始,Inter另外增 加了Brand ID(品種標識)用來輔助應用程序識別CPU的類型,因此根據“068X”CPUID還不能正確判別Pentium和Celerom處理 器。必須配合Brand ID來進行細分。

AMD處理器一般分爲三位,如“681”,從左至右分別表示爲Family(系列)、Mode(型號)和 Stepping(步進編號)。 

 

 

Type(類型) 

類型標識用來區別INTEL微處理器是用於由最終用戶安裝,還是由專業個人計算機系 統集成商、服務公司或製作商安裝;數字“1”標識所測試的微處理器是用於由用戶安裝的;數字“0”標識所測試的微處理器是用於由專業個人計算機系統集成 商、服務公司或製作商安裝的。我們通常使用的INTEL處理器類型標識都是“0”,“0F24”CPUID就屬於這種類型。

 

Family(系列) 

系列標識可用來確定處理器屬於那一代產品。如6系列的INTEL處理器包括Pentium Pro、Pentium II、 Pentium II Xeon、Pentium III和Pentium III Xeon處理器。5系列(第五代)包括Pentium處理器和採用 MMX技術的Pentium處理器。AMD的6系列實際指有K7系列CPU,有DURON和ATHION兩大類。最新一代的 INTEL Pentium 4系列處理器(包括相同核心的Celerom處理器)的系列值爲“F” 

 

Mode(型號) 

型號標識可用來 確定處理器的製作技術以及屬於該系列的第幾代設計(或核心),型號與系列通常是相互配合使用的,用於確定計算機所安裝的處理器是屬於某系列處理器的哪種特 定類型。如可確定Celerom處理器是Coppermine還是Tualutin核心;Athlon XP處理器是Paiomino還是 Thorouhgbred核心。 

 

Stepping(步進編號) 

步進編號用來標識處理器的設計或製作版本,有助於控制和跟蹤處理器的更 改,步進還可以讓最終用戶更具體地識別其系統安裝的處理器版本,確定微處理器的內部設計或製作特性。步進編號就好比處理器的小版本號,如CPUID爲 “686”和“686A”就好比WINZIP8.0和8.1的關係。步進編號和核心步進是密切聯繫的。如CPUID爲“686”的Pentium III 處理器是cCO核心,而“686A”表示的是更新版本cD0核心。 

 

Brand ID(品種標識) 

INTEL從Coppermine核心的處理器開始引入Brand ID作爲CPU的輔助識別手段。如我們通過Brand ID可以識別出處理器究竟是Celerom還是Pentium 4。

 

 

 

總結:

       從/proc/cpuinfo 這個文件,我們可以看出cpu的信息。 這個有2個概念。 一個是物理CPU個數和邏輯CPU 個數。 物理CPU 就是我們在主板上卡槽看到CPU的個數。 這個可以通過physical id 這個進行判斷。 有幾個不同的physical id 就有幾個物理CPU。 至於邏輯CPU 個數,我們可以通過processor來判斷。 這個比較簡單。 如果有2個物理封裝的的CPU,有16個邏輯CPU。 那麼每個物理封裝裏面就有8個邏輯CPU。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章