[理工] 106台科資工概論 對答案

作者: brilliantl (brilliant)   2018-01-16 12:37:34
各位大大好
剛寫了台科考古但手邊沒答案
在這邊po上我的答案
如果有寫錯的拜託各位多多指教 ((跪
題目:
https://imgur.com/w84LKMj
https://imgur.com/ZxDTFi5
https://imgur.com/QDiOI2W
https://imgur.com/cWCRoLW
我的答案:
1.F T F F T
2.(a) O(1) < O(logn) < O(n) < O(nlogn) < O(n^2) < O(2^n) < O(n!)
(b) Theta(n^2) 不是很確定
3.(a) //-de*+ab-cdf
(b) de-ab+cd-*/f/
4.(a) worse case: O(n^2)
best case: O(nlogn)
(b) 若是要將數列由小到大排序,worse case的情況是pivot都選到最小或最大值
best case 的情況是pivot都選到中位數
不是很確定是不是這樣寫就好
5.假設每個resource都只有一個=>RAG畫出來有circular wait的現象=>有deadlock
6.(a)log_2(16)+log_2(2048) = 4+11 = 15 bits
(b)log_2(16) = 4 bits
(c)log_2(4)+log_2(2048) = 2+11 = 13 bits
7.8 times 有查過前面的文章,應該是對的
8.(a)code sequence 1: 1+1+8 = 10 => code sequence 1 執行比較多的指令
code sequence 2: 2+1+1 = 4
(b)code sequence 1: 1x7 + 1x3 + 8x1 = 18 cycles => 一樣快
code sequence 2: 2x7 + 1x4 + 1x1 = 18 cycles
(c)code sequence 1: 18/10 = 1.8
code sequence 2: 18/4 = 4.5
(d)code from compilier 1: 10^9 x( 3x7 + 1x3 + 1x1)/( 5x10^9 ) = 5 seconds
code from compilier 2: 10^9 x( 1x7 + 3x3 + 4x1)/( 5x10^9 ) = 4 seconds
=> code form compilier 2 is faster
(e)code from compilier 1: 10^9 x(3+1+1)/(5x10^6) = 1000 mips
code from compilier 2: 10^9 x(1+3+4)/(4x10^6) = 2000 mips
=>code from compilier 2 is faster
9.如圖 https://imgur.com/MjbWiXu
10.(a) 2 no-ops between 16 and 20
2 no-ops between 20 and 24
(b) 假設branch是在EX stage決定的
total cycle = 3+1+3+(5-1) = 10 ctcles
雖然台科相較台清交容易,但還是怕手殘有算錯
還請各位幫忙找錯,感激不盡!
作者: bighb69738 (Vic)   2018-01-16 17:03:00
8.e 1600 錯了 應該除4
作者: a1596482   2018-01-16 21:39:00
想請問第九題的cache 3,是不是只有4個block?這樣我算只有兩個hit而已

Links booklink

Contact Us: admin [ a t ] ucptt.com