歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> linux下查看cpu物理個數和邏輯個數

linux下查看cpu物理個數和邏輯個數

日期:2017/3/1 16:20:22   编辑:關於Linux
linux下查看cpu物理個數和邏輯個數 [plain] hadoop@chw-desktop3:~$ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Pentium(R) 4 CPU 3.00GHz stepping : 9 microcode : 0x17 cpu MHz : 2992.615 cache size : 512 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes 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 ht tm pbe pebs bts cid xtpr bogomips : 5985.23 clflush size : 64 cache_alignment : 128 address sizes : 36 bits physical, 32 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Pentium(R) 4 CPU 3.00GHz stepping : 9 microcode : 0x17 cpu MHz : 2992.615 cache size : 512 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1 apicid : 1 initial apicid : 1 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes 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 ht tm pbe pebs bts cid xtpr bogomips : 5990.44 clflush size : 64 cache_alignment : 128 address sizes : 36 bits physical, 32 bits virtual power management: 輸入命令cat /proc/cpuinfo 查看physical id有幾個,上述結果顯示只有0,所以只有一個物理cpu;查看processor有幾個,上述結果顯示有0和1兩個,所以有兩個邏輯cpu。 (一)概念 ① 物理CPU 實際Server中插槽上的CPU個數 物理cpu數量,可以數不重復的 physical id 有幾個 ② 邏輯CPU /proc/cpuinfo 用來存儲cpu硬件信息的 信息內容分別列出了processor 0 –processor n 的規格。這裡需要注意,n是邏輯cpu數 一般情況,我們認為一顆cpu可以有多核,加上intel的超線程技術(HT), 可以在邏輯上再分一倍數量的cpu core出來 邏輯CPU數量=物理cpu數量 x cpu cores 這個規格值 x 2(如果支持並開啟ht) 備注一下:Linux下top查看的CPU也是邏輯CPU個數 ③ CPU核數 一塊CPU上面能處理數據的芯片組的數量、比如現在的i5 760,是雙核心四線程的CPU、而 i5 2250 是四核心四線程的CPU 一般來說,物理CPU個數×每顆核數就應該等於邏輯CPU的個數,如果不相等的話,則表示服務器的CPU支持超線程技術 ㈡ 查看CPU信息 當我們 cat /proc/cpuinfo 時、 具有相同core id的CPU是同一個core的超線程 具有相同physical id的CPU是同一個CPU封裝的線程或核心 ㈢ 下面舉例說明 ① 查看物理CPU的個數 #cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l 2 ② 查看邏輯CPU的個數 #cat /proc/cpuinfo |grep "processor"|wc -l 24 ③ 查看CPU是幾核 #cat /proc/cpuinfo |grep "cores"|uniq 6 我這裡應該是2個Cpu,每個Cpu有6個core,應該是Intel的U,支持超線程,所以顯示24
Copyright © Linux教程網 All Rights Reserved