SMP——Symmetric Multi-Processing (SMP),即对称多处理器结构
AMP——Asymmetric Multi-Processing (AMP) ,非对称多处理器结构
1.Linux查看是否是处于SMP环境
如何查看我们的Linux是SMP还是AMP,如下List-1,参考博客《Linux确认工作在SMP环境中》
List-1 "uname -a"命令的结果中含有SMP,这是我的CentOS7 64bits上的结果
代码语言:javascript复制[dmj@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
List-2 "uname -a"命令的结果中含有SMP,这是我的Ubuntu16 64bits上的结果
代码语言:javascript复制dmj@ubuntu:~$ uname -a
Linux ubuntu 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
2.AMP和SMP的特征对比
AMP system的主要特征如下:
- multiple CPUs
- each of which may be a different architecture but can be the same
- each has its own address space
- each may or may not run an OS and the OSes need not be the same
- some kind of communication facility between the CPUs is provided
SMP system的主要特征如下:
- multiple CPUs
- each of which has the same architecture
- CPUs share memory space or, at least, some of it
- normally an OS is used and this is a single instance that runs on all the CPUs, dividing work between them
- some kind of communication facility between the CPUs is provided and this is normally shared memory
SMP的特征是:只有一个操作系统实例,运行在多个CPU上,每个CPU的结构都是一样的,内存、资源共享。这种系统有一个最大的特点就是共享所有资源。
AMP的特征是:多个CPU,各个CPU在架构上不一样,每个CPU内核运行一个独立的操作系统或同一操作系统的独立实例,每个CPU拥有自己的独立资源。这种结构最大的特点在于不共享资源。
我们平时使用的机器基本都是SMP system,我目前还没有见过AMP system。
所以为什么说Java的伪共享在SMP系统上严重,通过SMP系统的特性可以明白——因为SMP系统共享资源,关于伪共享,可以查看我的另一篇博客。
Reference:
- http://scitechconnect.elsevier.com/asymmetric-multi-processing-amp-vs-symmetric-multi-processing-smp/
- https://blog.csdn.net/honour2sword/article/details/45248121
- https://blog.csdn.net/maochengtao/article/details/42583585
(adsbygoogle = window.adsbygoogle || []).push({});