Skip to content

Chapter 1 Fundamentals of computer system

冯诺依曼结构(Von Neumann Structure)
  • 数据和程序统一存储在内存中,CPU从内存取指令和数据执行,运算结果写回内存。

Flynn 分类法

类型() 示意图
SISD(单指令单数据)
SIMD(单指令多数据)
MISD(多指令单数据)
MIMD(多指令多数据)

注:IS=指令流,DS=数据流,CS=控制流,CU=控制单元,PU=处理单元

Measuring Data Size
单位 换算关系
bit 1 位(二进制位)
nibble 4 bits
byte 8 bits
word 嵌入式/移动处理器:4 bytes (32 bits)
桌面/服务器:8 bytes (64 bits)
kibibyte (KiB) [kilobyte (KB)] \(2^{10}\) (1,024) bytes
mebibyte (MiB) [megabyte (MB)] \(2^{20}\) (1,048,576) bytes
gibibyte (GiB) [gigabyte (GB)] \(2^{30}\) (1,073,741,824) bytes
tebibyte (TiB) [terabyte (TB)] \(2^{40}\) (1,099,511,627,776) bytes
pebibyte (PiB) [petabyte (PB)] \(2^{50}\) (1,125,899,906,842,624) bytes
CPU 性能回顾
\[ Performance = \frac{1}{Execution\ time} \]
\[ \frac{Performance_X}{Performance_Y} = \frac{Execution\ time_Y}{Execution\ time_X} = n \]
\[ CPU\ Time = CPU\ Clock\ Cycles × Clock\ Cycle\ Time = \frac{CPU\ Clock\ Cycles}{Clock\ Rate} \]
\[ CPI = \frac{CPU\ Clock\ Cycles}{Instruction\ Count} \]
\[ CPU\ Time = IC × CPI × Clock\ Period = \frac{IC × CPI}{Clock\ Rate} \]
\[ CPI = \sum_{i=1}^n (CPI_i × \frac{IC_i}{IC}) \]

Amdahl's Law

\[ T_{new} = T_{old} × \left[(1-F_{enhanced}) + \frac{F_{enhanced}}{S_{enhanced}}\right] \]
\[ Speedup_{overall} = \frac{T_{old}}{T_{new}} = \frac{1}{(1-F_{enhanced}) + \frac{F_{enhanced}}{S_{enhanced}}}< \frac{1}{1-F_{enhanced}} \]
  • \(F_{enhanced}\):可优化部分的执行时间占总时间的比例(\(≤1\)
  • \(S_{enhanced}\):可优化部分的性能加速比(\(>1\)

  • 若某部分的执行时间占比为 \(0\),则对其优化无任何效果;若需大幅提升整体性能,需让可优化部分的时间占比尽可能高。