A New Golden Age for Computer Architecture
中文文章
RISC = RAM for cache, simple ISA, better chip integration, better load-store ISAs
出現 RISC 贏過 CISC 的公式 (4X 快)
ProgramTime=ProgramInstructions×InstructionsClock cycles×Clock cyclesTime 在 PC 時代還是 x86 主宰市場,但在後 PC 時代已經是 RISC 的天下 (99% Processors)
CISC 已經 30 年沒有突破,VLIW 是 15 年,目前還是 RISC 的天下
End of the uniprocessor era
市場改變 => 從 PC/Server 變成 IoT/Mobile/Clouds
Software Programmer 在撰寫程式前更需要知道硬體運作
或是找出方法讓 Python 也可以 run 的跟 C with compiler + HW 一樣
Great Ideas in Computer Architecture
Abstraction (Layers of Representation/Interpretation)
High-level language program 如何藉由 Compiler, Assembler, Machine interpretation, Architecture implementation 來實現
以及其中牽涉到的 physics, electrons and quarks 等基礎原理是怎麼實作進來的
David House 提出 每 18 個月晶片的效能將會提高一倍
Principle of Locality/Memory Hierarchy
Jim Gray 定義了一系列譬喻 : "How far away is the data ?"
Memory : Sacramento (薩克拉門托城市)
而在 memory hierarchy 中,金字塔越往下代表 Cheaper, Bigger, Slower
但 ! Ahdahl's law 指出 : 並不是平行化的越多,如 X 倍,執行速度就 X 倍
要考慮工作中的 Serial part 是不能平行的 !
Great Performance measurement gives you great performance.
所以需要一個好的 benchmark 來測試效能 !
Dependability via Redundancy
利用 Redundancy 讓系統在某一個區塊錯誤時不會整個崩潰
在 datacenter, disks (RAID), memory bits (ECC) 都可以看到這樣的作法
Number representation
Bits can represent anything
Pi
N bits⟺ at most 2N things
327110=(3×103)+(2×102)+(7×101)+(1×100) 11012=(1×23)+(1×22)+(0×21)+(1×20)=8+4+0+1=13 0xA5=A516=(10×161)+(5×160)=160+5=165 Decimal to Binary
將二進位由大到小從左到右寫出
觀察是否可以被最大的減去,由左往右直到 1 為止 :
Decimal to Hexadecimal
跟上面差不多 :
Binary to Hexadecimal
將 二進位補滿 4 個數一組,再轉換每組數字 :
e.g., 11110 to hex : 111100001111011110=00011110=1=8+4+2=14=E=1E Hexadecimal to Binary
跟上面相反,把數字拆開成為 4 個一組的二進位數,再把前面多餘的 0 刪掉 :
e.g., 1E to binary : 1E1E=0001=14=8+4+2+0=1110=00011110=11110 Binary Operations
Add, subtract is same as decimal.
Binary Overflow
當兩個 binary 數值相加超過 hardware 能承受最大的 bits (11...1) 時,就會發生 Overflow
Binary Negative numbers
Sign and Magnitude
在原本沒有負數的 unsigned numbers 取他的最左 bit 做為正負號 (0001 => 1001)
若有 N bits 則範圍為 (減一是因為 0)
−(2N−1−1)∼(2N−1−1)
Ones' complement
若有 N bits 則範圍為 (減一是因為 0)
−(2N−1−1)∼(2N−1−1)
需要循環進位的電路 (將 overflow 加回最低位)
Two's complement
利用在 negative, complement + 1 來解決兩個 0 的 "Overlap" (0001 => 1110 => 1111)
範圍為
−(2N−1)∼(2N−1−1)
因為解決了 0 的問題,看起來像是負數比正數還要多一個
負數可以用二的 power 來表示,公式為
d31×−(231)+d30×230+⋯+d1×21+d0×20
例如 1101 :
=1×−(23)+1×22+0×21+1×20=−(23)+22+0+20=−8+4+0+1=−3
Fraction representation
representation 方式跟 decimal 差不多 : 而轉換方式如下 :
10.10102=1×21+1×2−1+1×2−3=2.62510 加法 :
multiplication
Scientific Notation
Floating Point Representation
IEEE 754 Floating Point Standard
Representation for ± ∞
Representation for 0
Special Numbers
NaN
Memory management
memory management
stack
Heap
malloc
3 way find free space first, next, best fit