闲侃CPU(一)

这个文章系列来自于Brendan Gregg所著《Systems Performance: Enterprise and the Cloud》一书第六章《CPU》的读书笔记。

系统板卡上的CPU插槽称之为socket,一颗物理CPU芯片可以称之为processor。现在CPU早已经进入多核时代,一颗CPU processor可以包含多个core,而一个core又可以包含多个hardware thread。每个hardware thread在操作系统看来,就是一个logic CPU,即一个可以被调度的CPU实例(instance)。举个例子,如果一颗CPU processor包含4core,而每个core又包含2hardware thread,则从操作系统角度看来,一共有8个可以使用的“CPU”(1*4*2 = 8)。

lscpu输出为例:

[root@linux ~]# lscpu
......
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                120
On-line CPU(s) list:   0-119
Thread(s) per core:    2
Core(s) per socket:    15
Socket(s):             4
......

120 = 2 * 15 * 4, 即CPU(s) = Thread(s) per core * Core(s) per socket * Socket(s)

 

为了改善内存访问性能,CPU processor提供了寄存器3cache。整个存储模型如下所示(从上往下,容量越小,CPU访问越快):
* register(寄存器)
L1 cache
L2 cache
L3 cache
Main memory(主存储器)
Storage Device(外接存储器)

《闲侃CPU(一)》有1个想法

御宅暴君进行回复 取消回复

邮箱地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.