# Computer Architecture Interview ###### tags: `Interview` ## Problem List: --- ### Cache * It's the buffer bewteen CPU and main memory --- ### What is pipeline * 5-stage pipeline: Fetch->Decode->ALU->Memory acess->Write back * Increasing throughput, * latency would not chnge * 需加上pipeline register --- ### What is `hazard` * ***data hazard*** 當後一個stage需要讀取資料時,但前一個stage還沒寫進去 解法: write forward/stall(bubble) * ***control hazard*** 當發生branch/jump時 解法: 用猜的,如果猜錯在flush掉(likely/unlikely) * ***Structural Hazard*** 由於部份功能單元沒有管線化,或是所需之資源沒有複製足夠多份,使oCPU 無 法支援某些次序指令的執行 --- ### What is `DMA` 不用透過 CPU 控制,周邊設備會跟記憶體之間相互傳送資料的通道,在這種方式下,周邊設備利用 DMA 通道直接將資料寫入 HD 或將資料從 HD 中讀出,而不用經過 CPU 運算,系統的速度會因此增加 * 使用dma系列api --- ## Reference * [黃婷婷](https://hackmd.io/@jkrvivian/rkloHgHcx?type=view)