免費詳解 / 中央 / 硬體 / 103

103 中央資工所考古題解答|硬體逐題詳解

103 中央資工所硬體考古題的逐題詳解,共 20 題,免費公開。

逐題詳解

15 分

Which of the following statements are true about the assumption and definition of branch prediction?

(A) Data that is being operated on has regularities.

(B) Underlying algorithm has regularities.

(C) Static branch prediction usually outperforms dynamic branch prediction.

(D) The hypothesis of correlating branches is that the behavior of other branch instructions do not affect the prediction of current branch.

(E) In general, an \((m,n)\) correlating predictor records the last \(m\) branches to select between \(m\) history tables each with \(n\)-bit counters.

(A)(B) 預測能成功是因為資料與演算法的分支行為有規律(loop、固定比例) → T

(C) dynamic 用歷史、準確率通常較高 → F

(D) correlating 的假設正好相反:其他 branch 的結果會影響目前這個 branch → F

(E) \((m,n)\) predictor 用最近 \(m\) 個 branch 的結果在 \(2^m\) 個 history table 中選一個,每個 table 是 \(n\)-bit counter;不是 \(m\) 個 → F

(A), (B)

25 分

Suppose that FPSQR instructions are improved with speedup = 10. FPSQR instructions are responsible for 20% of the execution time. What is the overall speedup?

(A) 1.08 (B) 1.22 (C) 1.35 (D) 1.55 (E) 1.67

Amdahl:\(\text{speedup}=\dfrac1{(1-0.2)+0.2/10}=\dfrac1{0.82}=1.22\)

(B)

35 分

Compute the clock cycle per instruction (CPI) for the following instruction mix. The mix includes 22% loads, 11% stores, 49% R-format operations, 16% branches, and 2% jumps. The number of clock cycles for each instruction class is listed as follows. 5 cycles for loads, 4 cycles for stores, 4 cycles for R-format instructions, 3 cycles for branches, 3 cycles for jumps.

(A) 3.58 (B) 3.76 (C) 4.04 (D) 4.28 (E) 4.52

\(CPI=0.22\cdot5+0.11\cdot4+0.49\cdot4+0.16\cdot3+0.02\cdot3=1.10+0.44+1.96+0.48+0.06=4.04\)

(C)

45 分

Which of the following statements are true?

(A) RISC architecture usually needs more special purpose registers than CISC.

(B) For a cache with write back strategy, read misses might result in writes.

(C) The advantages of dynamic scheduling include memory latency hiding and resolving real dependence which is unknown at compile time.

(D) Out-of-order completion might result in write after write (WAW) and write after read (WAR) hazards.

(E) Distributed shared-memory scheme might result in non-uniform memory access time for multiprocessor machines.

(A) RISC 靠大量 general purpose register,special purpose register 反而比 CISC 少 → F

(B) read miss 換出 dirty block 要先寫回 → T

(C) dynamic scheduling 能容忍不可預測的延遲(cache miss 時先執行後面無關的指令),也能處理編譯時未知的 dependence(memory address) → T

(D) OoO completion 會出現 WAW、WAR → T

(E) distributed shared memory:本地與遠端 memory 時間不同=NUMA → T

(B), (C), (D), (E)

55 分

What is the average memory access time for the memory with the following two-way set-associative cache? The hit time is 1.1 clock cycle. The miss rate is 0.04. And the miss penalty is 8 clock cycles.

(A) 1.02 clock cycles (B) 1.12 clock cycles (C) 1.22 clock cycles (D) 1.32 clock cycles (E) 1.42 clock cycles

\(\text{AMAT}=\text{hit time}+\text{miss rate}\times\text{miss penalty}=1.1+0.04\times8=1.42\)

(E)

65 分

\(K\) is the 32-bit IEEE754 floating-point number of (1987/6). \(N\) is the number of bits equal to "1" in \(K\). What is "\(N\bmod5\)"?

(A) 0 (B) 1 (C) 2 (D) 3 (E) 4

\(1987/6=331+1/6\)

\(331=101001011_2\),\(1/6=0.0010101\ldots_2\)

\(331.1\overline{6}=101001011.0010101010\ldots_2=1.01001011\,0010101010101\ldots_2\times2^8\)

sign \(=0\);exponent \(=127+8=135=10000111_2\)(4 個 1)

fraction(23 bits)\(=01001011\ \underbrace{001010101010101}_{15\text{ bits}}\):前 8 bits 有 4 個 1,後 15 bits(第 3、5、…、15 位為 1)有 7 個 1

第 24 位起是 \(0101\ldots\),不足半個 ulp,捨去

\(N=0+4+4+7=15\) → \(15\bmod5=0\)

(A)

75 分

Which of the following statement(s) are correct?

(A) Inserting L2 cache will not affect the miss rate of L1 cache.

(B) The case of "TLB hit, Page Table hit, Cache miss" is possible.

(C) One of the advantages of the superscalar processor over VLIW is the backward compatibility of the software.

(D) In a pipelined system, forwarding can help to eliminate all the stalls resulting from data hazards.

(E) The advantage of using microprogramming in designing the control is the execution speed.

(A) L1 的 miss rate 只跟 L1 自己的大小、結構有關,多一層 L2 只改變 miss penalty → T

(B) 位址轉換成功(TLB hit,page 在 memory 裡)之後 cache 仍可能 miss → T

(C) superscalar 由硬體在執行時排程,舊的 binary 照跑;VLIW 的 binary 綁死硬體的 issue slot → T

(D) load-use hazard 即使 forwarding 也要 stall 一個 cycle → F

(E) microprogramming 的優點是彈性、容易修改與實作複雜指令,速度比 hardwired 慢 → F

(A), (B), (C)

85 分

Which of the following sum terms must be included in the sum-of-products simplification for \((A'+B+C')(A+C+D')(A+B+C)(B+D)\)?

(A) \(AB\) (B) \(BD'\) (C) \(A'BD\) (D) \(AC'D\) (E) \(A'CD\)

先找 \(F=1\) 的 minterm(\(ABCD\) 編號):各 sum term 為 0 的格子要排除

\(A'+B+C'=0\):\(A=1,B=0,C=1\)(\(1010,1011\) 兩格);\(A+C+D'=0\):\(A=0,C=0,D=1\)(\(0001,0101\));\(A+B+C=0\):\(A=B=C=0\)(\(0000,0001\));\(B+D=0\):\(B=D=0\)(\(0000,0010,1000,1010\))

\(F=1\) 的 minterm:\(m_3,m_4,m_6,m_7,m_9,m_{12},m_{13},m_{14},m_{15}\)

AB\CD00011110
000010
011011
111111
100100

prime implicant:\(A'CD\)(\(m_3,m_7\))、\(AC'D\)(\(m_9,m_{13}\))、\(BD'\)(\(m_4,m_6,m_{12},m_{14}\))、\(AB\)(\(m_{12\sim15}\))、\(BC\)(\(m_6,m_7,m_{14},m_{15}\))

\(m_3\) 只被 \(A'CD\) 蓋、\(m_9\) 只被 \(AC'D\) 蓋、\(m_4\) 只被 \(BD'\) 蓋 → 三個都是 essential,必須出現

\(AB\)、\(BC\) 只剩 \(m_{15}\) 要補,二選一,不是必須的;\(A'BD\) 不是 implicant(含 \(m_5=0\))

(B), (D), (E)

95 分

A 32-bit cache memory address is decomposed into 3 fields: Tag (bits 31–19), Set (bits 18–4), Offset (bits 3–0). Assume the cache is 2-way set associative. The total size (including tag and data bits but excluding other valid/dirty bits) of the cache memory is \(L\) KB (Kbytes). \(N=\text{round}(L)\bmod5\). Then \(N\) is equal to

(A) 0 (B) 1 (C) 2 (D) 3 (E) 4

Tag \(=31-19+1=13\) bits,Set \(=18-4+1=15\) bits,Offset \(=4\) bits(block \(=16\) B \(=128\) bits)

set 數 \(=2^{15}\),2-way → block 數 \(=2^{16}\)

每個 block:data \(128\) bits \(+\) tag \(13\) bits \(=141\) bits

\(L=2^{16}\times141\text{ bits}=2^{16}\times141/8\text{ B}=1{,}155{,}072\text{ B}=1128\text{ KB}\)

\(N=1128\bmod5=3\)

(D)

105 分

We want to evaluate the performances of two computers M1 and M2. M1 has a clock rate of 1GHz and M2 has a clock rate of 800MHz. The following shows the CPI of 3 instruction classes, and the instruction mixes produced by 3 compilers C1, C2, C3:

ClassCPI M1CPI M2C1C2C3
A3230%25%50%
B4450%25%30%
C4320%50%20%

Assume that any of the three compilers (C1, C2, C3) can be used in M1 and M2. We also assume that the numbers of instructions from C1 and C2 are the same for both M1 and M2 and equal to 1000, while the number of instructions from C3 is 1050 (for both M1 and M2). Which of the following combinations of compiler + computer will you choose?

(A) C1+M1 (B) C2+M1 (C) C3+M1 (D) C2+M2 (E) C3+M2

cycle time:M1 \(=1\) ns,M2 \(=1.25\) ns;time \(=IC\times CPI\times T_{clk}\)

CPI(M1):C1 \(=0.3\cdot3+0.5\cdot4+0.2\cdot4=3.7\);C2 \(=0.25\cdot3+0.25\cdot4+0.5\cdot4=3.75\);C3 \(=0.5\cdot3+0.3\cdot4+0.2\cdot4=3.5\)

CPI(M2):C1 \(=0.3\cdot2+0.5\cdot4+0.2\cdot3=3.2\);C2 \(=0.25\cdot2+0.25\cdot4+0.5\cdot3=3.0\);C3 \(=0.5\cdot2+0.3\cdot4+0.2\cdot3=2.8\)

M1:C1 \(=1000\cdot3.7=3700\) ns;C2 \(=3750\) ns;C3 \(=1050\cdot3.5=3675\) ns

M2:C1 \(=1000\cdot3.2\cdot1.25=4000\) ns;C2 \(=1000\cdot3.0\cdot1.25=3750\) ns;C3 \(=1050\cdot2.8\cdot1.25=3675\) ns

最短是 3675 ns:C3+M1 與 C3+M2 打平

(C), (E)

115 分

Most systems allow programs to allocate more memory to its address space during execution. Data allocated in the heap segments of programs is an example of such allocated memory. What is required to support dynamic memory allocation in the following schemes:

(A) contiguous-memory allocation. (B) pure segmentation. (C) pure paging. (D) paged segmentation (E) none

要看「長大時是否得重新搬動(relocate)」

(A) contiguous:後面空間被占住就必須把整個 program 搬到更大的空洞 → 需要支援(relocation) → T

(B) pure segmentation:要加大的 segment 可能放不下,要搬動這個 segment → T

(C) pure paging:直接多配 page frame、改 page table,不必搬動、不要求連續 → F

(D) paged segmentation:segment 內又分頁,同樣不必搬動 → F

(C)(D) 沒有「需要額外支援」的要求;若把題意讀成「哪些方式能撐得起」則 (B)(C)(D) 都可,但題目問的是需要什麼支援

(A), (B)

125 分

Consider a demand-paging system with the following time-measured utilizations: CPU utilization 20%, Paging disk 97.7%, Other I/O devices 5%. Which (if any) of the following will (probably) improve CPU utilization?

(A) Install a faster CPU.

(B) Install a bigger paging disk.

(C) Increase the degree of multiprogramming.

(D) Decrease the degree of multiprogramming.

(E) Install more main memory.

CPU 20% 而 paging disk 97.7% → thrashing:大部分時間在換頁

(A) CPU 不是瓶頸 → F

(B) disk 容量與換頁速度無關 → F

(C) 程式更多、page fault 更多、更糟 → F

(D) 減少 process 數,working set 放得下 → T

(E) 記憶體變大,page fault 變少 → T

(D), (E)

135 分

Which of the functionalities listed below need to be supported by the operating system for the real-time systems?

(A) Batch programming (B) Virtual memory (C) Time sharing (D) Spooling (E) Interrupt driving

(A)(D) batch、spooling 讓工作排隊等待,延遲不可預測 → F

(B) page fault 使執行時間不可預測,real-time 通常不用 virtual memory → F

(C) time sharing 的公平輪流與 real-time 的 deadline/priority 排程衝突(hard real-time 無法與 time sharing 並存) → F

(E) 外部事件要靠 interrupt 立即通知 → T

這題與 102 年第 11 題同樣改自 Silberschatz 第 1 章的習題。有版本的參考解答把 real-time 也列入 virtual memory 與 time sharing(理由是讓工作公平分享資源),但 real-time 系統要的是可預測的反應時間:page fault 與分時輪流都會讓執行時間不可預測,hard real-time 通常不用;這裡以可預測性為準,只選 (E)

(E)

145 分

What are the purposes of the separation of mechanism and policy?

(A) Easy for programming (B) Systems are easy to modify (C) Flexibility to suit its needs (D) Increasing utilization (E) Quick and fast system response

mechanism 決定「怎麼做」,policy 決定「做什麼」;兩者分開後 policy 改了不必動 mechanism

(B)(C) 容易修改、可依需求調整 → T

(A)(D)(E) 不是分離的目的 → F

(B), (C)

155 分

For a graphics card with direct bus connection accessible through memory mapped I/O, the better designs of the operating system are to use (A) buffering, (B) spooling, (C) caching, and (D) polled I/O or interrupt-driven I/O, (E) neither of polled I/O and interrupt-driven I/O.

(A) 用 buffering 管理多個存取、做 double buffering(顯示目前的畫面時準備下一張) → T

(B) spooling:卡是共用且高速的裝置,不需要 → F

(C) caching:同上,不需要 → F

(D)(E) polling/interrupt 只用於輸入與 I/O 完成偵測;memory-mapped 的顯示卡兩者都用不到 → (D) F,(E) T

(A), (E)

165 分

Which of the following scheduling algorithms could not result in starvation?

(A) First-come, first-served (B) Shortest job first (C) Round robin (D) Priority (E) None

(A) 依到達順序,一定輪到 → T

(B) 長工作可能一直被短工作插隊 → F

(C) 每個 process 輪流拿 quantum → T

(D) 低 priority 可能一直等 → F

(A), (C)

175 分

Choose the correct statements from the multiple choices regarding the real-time scheduling of Linux.

(A) Linux's real-time scheduling is soft real-time.

(B) Linux's kernel can guarantee a minimum latency between when a process becomes runnable and when it actually runs.

(C) Linux's scheduler offers strict guarantees about the relative priorities of real-time process.

(D) Linux implements both First Come, First Served (FCFS) and Round-Robin (RR) real-time scheduling classes.

(E) Among processes of equal priority, Linux will run process randomly.

(A) Linux 是 soft real-time → T

(B) kernel 不保證 process 變成 runnable 後多快被執行 → F

(C) real-time process 之間的相對 priority 有嚴格保證 → T

(D) SCHED_FIFO(FCFS)與 SCHED_RR → T

(E) 同 priority 依 FIFO/RR,不是隨機 → F

(A), (C), (D)

185 分

Choose the correct statements from the multiple choices regarding the disk scheduling.

(A) The SCAN scheduling performs better for systems that place a heavy load on the disk.

(B) Either SSTF or LOOK is a reasonable choice for the default algorithm.

(C) Solid-State Drives (SSD) commonly use an FCFS policy.

(D) The Linux Noop scheduler uses an FCFS policy.

(E) None of the above.

(A) 負載重時 SCAN 類的 starvation 較少、表現較好 → T

(B) SSTF 與 LOOK 都是合理的預設 → T

(C) SSD 沒有磁頭搬動,常用 FCFS → T

(D) Linux NOOP 用 FIFO 佇列(只合併相鄰請求) → T

(A), (B), (C), (D)

195 分

Choose the correct statements from the multiple choices regarding cloud computing.

(A) Software as a service (SaaS) provides a software stack ready for application use via the Internet.

(B) SaaS is a software delivery model in which software and associated data are centrally hosted on the cloud.

(C) SaaS provides one or more applications available via the Internet.

(D) A database server is a kind of SaaS.

(E) None of the above

(A) 「a software stack ready for application use」是 PaaS 的描述 → F

(B) SaaS:軟體與資料集中放在 cloud → T

(C) SaaS:透過 Internet 提供一個以上的應用程式(例:word processor) → T

(D) database server 屬於 PaaS → F

(B), (C)

205 分

Choose the correct statements from the multiple choices.

(A) The subnet mask for the subnet 200.23.16.0/23 is 255.255.255.0.

(B) The subnet 200.23.16.0/23 could accommodate up to 256 hosts.

(C) The broadcast address of the subnet 192.168.5.0/26 is 192.168.5.255.

(D) The number of available subnets for a /26 network is 8.

(E) None of the above.

(A) /23 的 mask 是 255.255.254.0 → F

(B) /23 有 \(2^9=512\) 個位址,可用 host 510 個 → F

(C) /26 一塊 64 個位址,192.168.5.0/26 的範圍是 .0–.63,broadcast 為 192.168.5.63 → F

(D) /24 切成 /26 只有 \(2^2=4\) 個 subnet → F

(E)

109–115 的詳解也是這樣寫的。

國立中央大學 109–115 的詳解收錄在付費版;106–115 全年度完整詳解共 510 頁,逐題推導。

購買 · NT$ 850 看中央其他免費詳解

其他年度與考科

同一年的其他科

同一科的其他年度

聯絡我們

題目有錯、詳解看不懂,都歡迎來信

想許願補哪一份、對購買有疑問也可以,收到後會盡快回覆。

william.chou.123123@gmail.com