# 阿姆达尔定律

1967年计算机体系结构专家吉恩.阿姆达尔提出过一个定律阿姆达尔定律，说：在并行计算中用多处理器的应用加速受限于程序所需的串行时间百分比。譬如说，你的程序50%是串行的，其他一半可以并行，那么，最大的加速比就是2。不管你用多少处理器并行，这个加速比不可能提高。在这种情况下，改进串行算法可能比多核处理器并行更有效。

## 公式

$$S_\text{latency}(s) = \frac{1}{1 - p + \frac{p}{s}}$$

• Slatency is the theoretical speedup in latency of the execution of the whole task;
• s is the speedup in latency of the execution of the part of the task that benefits from the improvement of the resources of the system;
• p is the percentage of the execution time of the whole task concerning the part that benefits from the improvement of the resources of the system before the improvement.
• 1-p is the percentage of the execution time of the whole task concerning the part that doesn't benefit from the improvement of the resources of the system before the improvement.

• Slatency代表理论上的加速比
• s 为并行处理结点个数
• p 为并行计算部分所占比例
• 1-p 为串行计算部分所占比例

Amdahl’s law表明在问题的可并行部分占比不大时，增加处理机的数量并不能显著地加快解决问题的时间。

$$S_\text{latency}(s) = 1 - p + sp$$

• Slatency is the theoretical speedup in latency of the execution of the whole task;
• s is the speedup in latency of the execution of the part of the task that benefits from the improvement of the resources of the system;
• p is the percentage of the execution workload of the whole task concerning the part that benefits from the improvement of the resources of the system before the improvement.

Gustafson定律说明在许多实际的应用程序中得到接近线性的加速效果是可能的。