# Computer-System Architecture 電腦系統結構
![](https://i.imgur.com/UI4g5tq.png)
### Single-Processor Systems 單處理器系統
![](https://i.imgur.com/OIduviI.png)
- **One main CPU** -> executing a general purpose instruction set 通用指令集(Include user instructions)
- Have **other special purpose processor**(keyboard, disk) -> run a limited instruction set
- Most of **Modern PCs**
### Multiprocessor Systems 多處理器系統
![](https://i.imgur.com/ipty0NN.png)
- aka. Parallel system(並行系統) or Tightly coupled systems(多核系統)
- **Have two or more processors** in close communication, **sharing** the computer bus(匯流排 -> 數據) and sometimes the clock, memory, and peripheral devices.
- First appeared in servers -> desktop and laptop ->-> mobile
- Blade Servers
#### Advantages
- Increased throughput 增加吞吐量(預期同時間內可以完成更多工作(次數))
- Economy of scale
- Increased reliable 增加可靠性✨
:::info
**graceful degradation 適度退化**
根據剩餘有效硬體的級別按造比例繼執行任務的能力。
**fault tolerant 容錯**
有的系統會將超過適度退化,但剩餘系統仍可以進行任務的行為稱為容錯。
:::
#### Type of Multiprocessor Systems
**Asymmetric Multiprocessing 非對稱多處理**
![](https://i.imgur.com/K9CcrXU.png =40%x)
- A boss–worker relationship
- The boss processor schedules and allocates work to the worker processors
- cheaper than SMP
**Symmetric Multiprocessing(SMP) 對稱多處理**
![](https://i.imgur.com/ru5qoCH.png =30%x)
- The most common systems(Windows, Mac OS X, and Linux)
- All processors are peers(可同時運作,不會造成效能下降)
- To ensure data reach the appropriate processordynamically (避免其中一方超載或閒置)
-> **shared processes and resources**(memory, I/O devices) --> 擴展能力有限!
:::success
![](https://i.imgur.com/17drOlp.png)
**Uniform-Memory-Access(UMA) 一致存儲器訪問**
- **Access to any RAM from any CPU takes the same amount of time**
- **Only one CPU can access RAM at a time**(some parts of memory may take longer to access than other parts, creating a performance penalty 效能損失)
- Mostly used for **PC**
![](https://i.imgur.com/gevS7YG.png)
**Nonuniform-Memory-Access(NUMA) 非一致存儲器訪問**
- **Each processor has its own memory**(讀寫內存效率 ⬆️)
- And each process **can also access the memory of other processors**(by QPI but slower than local)
- **One memory can only be accessed by one CPU at the same time**
- Mostly used for **server**
:::
### Clustered Systems 電腦叢集
![](https://i.imgur.com/TL4iGRH.png)
- Gather together multiple CPUs to accomplish computation work
- used to provide **high-availability service**
- can be structured asymmetrically or symmetrically
## Instruction set 指令集
> 電腦自己的機器語言
電腦是透過電晶體組成的邏輯電路進行複雜的計算與判斷,通過輸入指令與數據即可取得結果。(而這些指令經過重新劃分成一整套進行運算的集合,就是指令集。)
> 高階語言(C, Python, Javascript) -> 機器語言(二進位代碼, 指令)
![](https://i.imgur.com/FvHQiuM.jpg)
#### 指令集的設計類別
[CICS, RICS 歷史架構](https://www.techbang.com/posts/10678-fully-understand-arm-processors-cisc-and-risc-are-what-history-structure-a-see-through-the-computer-96-issues-cover-story-the-king?page=1)
| | CISC 複雜指令集電腦 | RISC 精簡指令集電腦 |
| ---- | --- | --- |
| 全文 | Complex Instruction Set Computer | Reduced Instruction Set Computer |
| 指令長短 | 不一致 | 一致 |
| 指令執行時間 | 不一致 | 一致 |
| **程式執行效率** | 低 | **高** |
| 指令執行 | 順序 -> 控制簡單 | 並行 |
| 指令豐富度 | O | X |
| 處理特殊指令 | 效率高 | 效率底(組合指令) |
| 代表 | x86(intel, AMD) | arm(蘋果, 高通, 聯發科)|
CISC 和 RISC 各有優勢,只是派別上的差異。實際上,現代有相當多的 CPU 採用 CISC 的外圍,但內部加入了 RISC 的特性(類 RICS),融合各自的優點。