110 年 國立中央大學資訊工程學系碩士班《作業系統與計算機組織》

📄 試題原卷 免費註冊後即可對照原始考卷 PDF免費註冊

第 1 題5 分

Given (1) an instruction has 32 bits, and (2) a cache memory with 64 blocks, 16 bytes/block, and 4-way set associative. Which of the following statements are true?

(A) Byte address 1200 maps to the set number 11.

(B) The index field requires 4 bits.

(C) The offset field is 12 bits.

(D) The tag field is 16 bits.

(E) None of the above.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

快取位址可拆成標籤(tag)、索引(index)與區塊內位移(offset):

位址位元數=tag 位元數+index 位元數+offset 位元數\text{位址位元數}=\text{tag 位元數}+\text{index 位元數}+\text{offset 位元數}

區塊大小決定 offset 位數;組數決定 index 位數。組相連快取的組數為「快取區塊總數 ÷ 相連路數」。

解題方法

每個區塊有 1616 bytes,因此區塊內位移需要:

log⁡216=4 bits\log_2 16=4\text{ bits}

快取共有 6464 個區塊,採 44-way set associative,因此組數為:

644=16 組\frac{64}{4}=16\text{ 組}

索引需要:

log⁡216=4 bits\log_2 16=4\text{ bits}

位址 12001200 對應的區塊編號為:

⌊120016⌋=75\left\lfloor\frac{1200}{16}\right\rfloor=75

組編號為區塊編號對組數取餘數:

75 mod 16=1175\bmod 16=11
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 2 題5 分

Which of the following statements are true for memory hierarchy?

(A) Spatial locality refers to the situation that an item tends to be referenced soon once it is referenced.

(B) When increasing the size of a cache block, the miss penalty decreases.

(C) Increasing cache associativity decreases the utilization of a cache.

(D) A valid bit indicates whether the data in a block is valid or not.

(E) A cache block is the basic unit for the cache storage.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考查記憶體階層中的區域性、快取區塊、相聯度與有效位元。

  • 時間區域性(temporal locality):某個資料或指令被存取後,近期內再次被存取的機率較高。
  • 空間區域性(spatial locality):某個資料或指令被存取後,其附近的資料或指令近期內也較可能被存取。
  • 快取區塊(cache block):快取與較低層記憶體之間搬移資料的基本單位;快取會以區塊為單位配置與儲存資料。
  • 有效位元(valid bit):標記快取區塊目前是否含有有效資料。若有效位元為 0,即使標籤吻合,也不能視為快取命中。
  • 相聯度(associativity):每個快取組中可放置的區塊數。相聯度提高時,區塊可放置的位置增加,通常能降低衝突失誤。

解題方法

逐項對照選項中的敘述與定義。判斷區域性時,特別留意「近期再次存取」屬於時間區域性,「附近位置也會被存取」才屬於空間區域性。判斷區塊大小與失誤代價時,則看失誤後需要搬移多少資料:區塊越大,通常搬移時間越長,失誤代價也越高。

選項分析

(A) 錯誤。
題目描述「某項目被參照後,很快再次被參照」,這是時間區域性。空間區域性描述的是相鄰位置較可能在近期被參照,因此選項混淆了兩種區域性。

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 3 題5 分

Which of the following statements are true regarding the pipeline hazards of a 5-stage MIPS CPU?

(A) The data forwarding technique passes data to the previous instructions that need the data.

(B) The structural hazard happens when a required resource is busy.

(C) Rearranging the instructions may solve some of the data hazards.

(D) If we put the register comparator and the target address calculator at the ID stage, then 2 stalls are needed for a branch hazard.

(E) If we put the register comparator and the target address calculator at the ID stage, and a comparison register is a destination of an immediately preceding load instruction, then 1 stall is needed.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

五級 MIPS 管線(IF、ID、EX、MEM、WB)的三類危障:

  • 結構危障:硬體資源同時被兩道指令需要。
  • 資料危障:指令需要前面指令尚未產生的結果,可用轉送(forwarding)、重排指令或停頓解決。
  • 控制危障:分支結果決定前不知道下一道指令;把比較器與目標位址計算移到 ID 階段,可把分支代價降到 1 個週期。

選項分析

  • (A) 錯誤。 轉送是把前面指令剛算出的結果,直接送給後面需要它的指令(從 EX/MEM、MEM/WB 管線暫存器送回 ALU 輸入),不是送給「先前的」指令。
  • (B) 正確。 結構危障的定義就是:所需的硬體資源(例如只有一個記憶體埠)正被其他指令占用。
  • **(C) 正確。
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 4 題5 分

Given the execution time of the 5 stages of a CPU: IF 200 ps, ID 100 ps, EXE 200 ps, MEM 200 ps, WB 100 ps. Which of the following statements are true?

(A) The ideal cycle time of a single-cycle CPU is 800 ps.

(B) The ideal execution time of “sw” for a single-cycle CPU is 800 ps.

(C) The ideal cycle time of a multiple-cycle CPU is 200 ps.

(D) The ideal execution time of “lw” for a multiple-cycle CPU is 800 ps.

(E) None of the above.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

  • 單週期 CPU:每條指令都在一個時脈週期內完成,因此時脈週期必須足以容納最慢指令的完整資料路徑。若最慢指令會依序經過五個階段,週期時間就是五個階段延遲的總和。
  • 多週期 CPU:一條指令可分成多個時脈週期執行,每個週期完成一個階段。理想週期時間由最慢階段決定;指令執行時間則為所需週期數乘上週期時間。

本題各階段延遲為:

TIF=200,TID=100,TEXE=200,TMEM=200,TWB=100 psT_{\mathrm{IF}}=200,\quad T_{\mathrm{ID}}=100,\quad T_{\mathrm{EXE}}=200,\quad T_{\mathrm{MEM}}=200,\quad T_{\mathrm{WB}}=100\ \text{ps}

解題方法

先分別求單週期與多週期 CPU 的週期時間,再依各指令的執行方式求執行時間。

單週期 CPU 的指令必須在同一週期內走完其資料路徑。以需要完整五階段的 lw 為例:

Tsingle=200+100+200+200+100=800 psT_{\mathrm{single}} =200+100+200+200+100 =800\ \text{ps}

多週期 CPU 的一個週期要能容納最慢的單一階段,因此:

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 5 題5 分

Given a 16-bit computer with the I-type instruction in the following format, which of the following statements are true?

🖼️【此處有附圖,請對照原卷】

(A) The computer supports at most 16 operations.

(B) The computer has 8 registers.

(C) The range of the number in the immediate field (in 2’s complement) is from −25-2^5 to 25−12^5-1.

(D) Each register is 8-bits long.

(E) None of the above.

🖼️ 本題含圖表,以下為原卷對應頁面:
原卷第 2 頁

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考指令格式中各欄位的位元數,如何決定可表示的操作數量、暫存器數量,以及二補數立即值範圍。若欄位有 nn 個位元,最多可表示 2n2^n 種編碼;nn 位元二補數的範圍則是 −2n−1-2^{n-1} 到 2n−1−12^{n-1}-1。

解題方法

原卷圖中的 16 位元指令格式標示為:操作碼 op 5 位元、來源暫存器 rs 3 位元、目標暫存器 rt 3 位元、立即值 immediate 5 位元。欄位總長為 5+3+3+5=165+3+3+5=16 位元。逐一依欄位位數計算其編碼能力,再判斷各敘述。

選項分析

  • (A) 錯誤。 5 位元操作碼最多有 25=322^5=32 種編碼,因此最多可支援 32 種操作,不是 16 種。
  • (B) 正確。 暫存器欄位有 3 位元,可編碼 23=82^3=8 個暫存器。
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 6 題5 分

Which of the following statements are true for dynamic branch prediction?

(A) Branch history table or branch prediction buffer can be implemented as a memory indexed by the lower bits of the program counter address.

(B) Branch prediction buffer must have tag and address check.

(C) A 2-bit dynamic branch predictor must miss twice before the prediction is changed.

(D) Mis-prediction can be caused by getting the branch history of the wrong branch when indexing the branch history table.

(E) Correlating branch predictors assume that the behaviour of a branch would not be affected by the behaviours of other branches.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

動態分支預測以**分支預測緩衝器(branch prediction buffer / branch history table, BHT)**記錄分支過去的行為。它是一小塊以 PC 低位元索引的記憶體,每格存 1 或 2 個位元的預測狀態,沒有標籤(tag)。

選項分析

  • (A) 正確。 BHT 就是用分支指令位址(PC)的低位元做索引的小記憶體。
  • (B) 錯誤。 預測緩衝器不需要標籤與位址比對:它只是「提示」,即使查到的是另一個分支的紀錄也只會影響預測準確度,不影響程式正確性(預測錯了再修正即可)。需要 tag 的是分支目標緩衝器(BTB)。
  • **(C) 正確。
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 7 題5 分

For RISC (Reduced Instruction Set Computer), which of the following statements are true?

(A) For any given level of general performance, a RISC chip will typically have far more transistors dedicated to the core logic compared with CISC (complex instruction set computer).

(B) RISC allows designers to increase the size of the register set.

(C) RISC usually uses uniform instruction format with the opcode in the same bit positions in every instruction, which demands less decoding complexity.

(D) RISC is not suitable for pipeline design and would decrease internal parallelism.

(E) RISC usually supports more addressing modes than CISC.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

RISC(精簡指令集電腦)的設計重點,是讓指令格式與執行方式較簡單且規則。固定長度或格式一致的指令、較少的定址模式,以及較精簡的控制邏輯,有助於簡化指令解碼並設計管線。相較之下,CISC(複雜指令集電腦)常以較複雜的指令與定址方式,減少程式所需的指令數。

解題方法

逐項檢查敘述是否符合 RISC 的典型特徵,特別留意選項是否把 RISC 與 CISC 的特性顛倒:RISC 的核心邏輯較精簡,因而能把晶片資源用於較大的暫存器組、管線等平行化設計;指令格式規則也有利於解碼與管線化。

選項分析

(A) 錯誤。 在相近的一般效能下,RISC 通常使用較少的電晶體實作核心邏輯。其簡化的指令與控制邏輯,能為暫存器組或其他硬體功能留出空間。題目說 RISC 在核心邏輯上使用「遠多於」CISC,方向相反。

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 8 題5 分

Assume that the frequency of Floating Point (FP) operations is 25% for a computer, and the average CPI (Clock Cycles Per Instruction) of FP operations is 4. The average CPI of other instructions is 1.5. By performing some enhancement on the hardware, we can reduce the average CPI of all FP operations to 2. All other factors are not changed after enhancement. Which of the following are true?

(A) The speedup for the FP operations is 2.

(B) The total speedup can be computed by Amdahl’s Law using the following equation:

speedup=1(1−0.25)+0.252=1.1428\mathrm{speedup}=\frac{1}{(1-0.25)+\frac{0.25}{2}}=1.1428

(C) The total speedup is 1.307.

(D) The CPI after enhancement is 1.859.

(E) The CPI before enhancement is 2.125.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考查平均 CPI、指令執行時間與 Amdahl 定律。

平均 CPI 必須依各類指令的指令比例加權計算:

CPIavg=∑i(第 i 類指令比例)(第 i 類指令的平均 CPI)\mathrm{CPI}_{\mathrm{avg}}=\sum_i \left(\text{第 }i\text{ 類指令比例}\right) \left(\text{第 }i\text{ 類指令的平均 CPI}\right)

在時脈頻率不變時,執行時間與總 CPU 時脈週期數成正比。若指令數不變,總速度提升倍率為:

Speedup=CPIbeforeCPIafter\mathrm{Speedup} = \frac{\mathrm{CPI}_{\mathrm{before}}} {\mathrm{CPI}_{\mathrm{after}}}

使用 Amdahl 定律時,加速比例須以原本的執行時間比例計算,不能直接把指令比例當成執行時間比例。

解題方法

設總指令數為 NN。改善前,FP 指令占 25%25\%,平均 CPI 為 44;其他指令占 75%75\%,平均 CPI 為 1.51.5。因此:

CPIbefore=0.25×4+0.75×1.5=1+1.125=2.125\mathrm{CPI}_{\mathrm{before}} =0.25\times 4+0.75\times 1.5 =1+1.125 =2.125

改善後,FP 指令平均 CPI 降為 22,其他指令不變:

CPIafter=0.25×2+0.75×1.5=0.5+1.125=1.625\mathrm{CPI}_{\mathrm{after}} =0.25\times 2+0.75\times 1.5 =0.5+1.125 =1.625

FP 指令本身的速度提升倍率為:

SpeedupFP=42=2\mathrm{Speedup}_{\mathrm{FP}}=\frac{4}{2}=2

整體速度提升倍率為:

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 9 題5 分

About instruction level parallelism, which of the following are true?

(A) To perform loop unrolling, loop iterations must be independent with no loop-carried dependence.

(B) True dependencies can be resolved by register renaming.

(C) Anti-dependence occurs when instruction jj writes a register or memory location that instruction ii read from, and instruction ii is executed first.

(D) Loop unrolling can reduce control stalls.

(E) Issuing multiple instructions per cycle can not reduce ideal CPI.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

指令層級平行(ILP)相關名詞:

  • 真相依(true / RAW):後面的指令讀取前面指令寫的值,是真正的資料流,不能消除。
  • 反相依(anti / WAR)、輸出相依(output / WAW):只是用到同一個名稱(暫存器),可用暫存器重新命名消除。
  • 迴圈展開(loop unrolling):複製迴圈本體,減少分支與迴圈控制指令,並擴大可排程的指令範圍。

選項分析

  • (A) 錯誤。 迴圈展開只是把多次迭代的本體寫在一起,有迴圈攜帶相依也可以展開,只要保留相依順序即可。例如 sum = sum + a[i] 展開成連續兩行更新仍然正確,只是這兩行不能互相平行。
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 10 題5 分

About memory hierarchy, which of the following are true?

(A) For virtual memory, usually write-through strategy is used to update the lower-level storage.

(B) Implementing higher associativity in cache can reduce conflict miss.

(C) For virtual memory, usually fully associative placement strategy is used.

(D) If the page size is larger, the size of the page table is also larger.

(E) If write-back strategy is used, it is possible that read misses would produce writes.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考查記憶體階層中的三類設計:資料放置方式、寫入策略,以及快取未命中的處理。

  • 全相聯放置:一個區塊可放到下層的任一位置。虛擬記憶體中,一個虛擬頁可對應到任一實體頁框。
  • 寫穿透(write-through):每次寫入快取時,也立即更新下一層;回寫(write-back):先只更新快取,等髒區塊被替換時再寫回下一層。
  • 快取未命中(miss):所需區塊不在快取中,必須從下一層載入;若替換掉的區塊是髒區塊,還要先將它寫回。
  • 頁表大小主要取決於虛擬頁數與每筆頁表項目的大小。固定虛擬位址空間時,頁面越大,虛擬頁數越少。

解題方法

逐項辨認敘述所描述的政策,再套用記憶體階層的標準設計原則:

  1. 虛擬記憶體的儲存裝置存取成本高,判斷其通常採用哪種寫入策略。
  2. 分辨提高快取相聯度會影響哪一類未命中。
  3. 以頁面與實體頁框的對應方式判斷虛擬記憶體的放置策略。
  4. 固定位址空間,依頁面大小計算頁數,推得頁表大小的變化。
  5. 檢查讀取未命中時,是否可能因替換髒區塊而產生寫入。

選項分析

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 11 題5 分

What are the factors that should be considered when deciding the page size?

(A) Size of page table

(B) Fragmentation

(C) I/O overhead

(D) Number of page faults

(E) None of the above

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

頁面大小會同時影響記憶體管理的空間成本與存取效能。選擇頁面大小時,通常要考慮頁表大小、內部碎裂、磁碟 I/O 成本,以及缺頁次數等因素;這些因素彼此牽制,沒有適用所有系統的單一最佳值。

解題方法

逐一判斷頁面大小對各項成本的影響:

  • 若虛擬位址空間大小為 VV、頁面大小為 PP,頁表項目數約為 ⌈V/P⌉\lceil V/P\rceil。頁面越大,所需頁表項目通常越少,頁表也較小。
  • 頁面越大,程式最後一頁未使用的空間可能越多,造成較大的內部碎裂。
  • 缺頁時通常要從後備儲存裝置載入頁面。頁面大小會影響每次 I/O 傳輸的資料量,也會影響傳輸次數及 I/O 成本。
  • 頁面大小會改變程式執行時的缺頁行為。較大的頁面可能一次載入更多鄰近資料,也可能載入未使用的資料,因此缺頁次數會受工作負載與區域性影響。

選項分析

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 12 題5 分

Choose the correct statements from the multiple choices regarding threads.

(A) Kernel-level threads are easier and faster to create than user-level threads.

(B) Different user-level threads of the same process can have different scheduling priorities.

(C) A blocking kernel-level thread blocks all threads in the process.

(D) For the Many-to-One multithreading model, one thread blocking causes all to block.

(E) None of the above.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考查使用者層級執行緒(user-level threads)與核心層級執行緒(kernel-level threads)的建立成本、排程方式,以及執行緒阻塞時對同一行程內其他執行緒的影響。

  • 使用者層級執行緒由執行緒函式庫管理,核心不必逐一介入建立與切換,通常建立與切換較快。
  • 核心層級執行緒由作業系統核心管理,核心可個別排程;單一執行緒阻塞時,同一行程的其他可執行緒仍可繼續執行。
  • Many-to-One 模型把多個使用者層級執行緒對應到一個核心層級執行緒。核心只看見一個執行緒,因此其中一個執行緒阻塞時,整個行程都無法繼續執行。

解題方法

逐項判斷時,先確認題目描述的是哪一層管理執行緒,再判斷核心是否能看見並個別排程該執行緒。若多個使用者層級執行緒共用單一核心層級執行緒,阻塞影響會擴及整個行程;若核心為每個執行緒分別管理,阻塞通常只影響該執行緒。

選項分析

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 13 題5 分

Choose the correct statements from the multiple choices regarding deadlocks.

(A) If the resource allocation graph contains a cycle, then the system is deadlocked.

(B) If a system is in an unsafe state, then there is no allocation sequence that allows the processes to finish executing.

(C) Pretending that deadlocks never occur in the system is a method to deal with deadlocks.

(D) Banker’s algorithm is a deadlock prevention algorithm.

(E) None of the above.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考查死結的判定,以及作業系統處理死結的幾種策略。

資源配置圖中的環不一定代表死結。若每種資源只有一個實例,圖中出現環便可判定有死結;若資源有多個實例,環只是死結的必要條件,不能單憑環確認死結。

安全狀態表示存在一個安全序列,使所有程序依序取得所需資源並完成。不安全狀態表示找不到這種安全序列,但不代表系統已經死結,也不代表程序絕對無法完成。

處理死結的常見策略包括預防、避免、偵測與復原,以及忽略死結。

解題方法

逐項比對選項敘述與定義:

  1. 檢查資源配置圖有環是否必然表示死結。
  2. 區分「不安全」與「已死結」。
  3. 辨認忽略死結、預防死結與避免死結各自的策略。
  4. 根據判斷結果確認正確選項。

選項分析

(A) 錯誤。 資源配置圖有環,不一定表示系統死結。只有在每種資源都只有一個實例時,有環才足以判定死結;若資源有多個實例,其他程序仍可能釋放資源,使等待中的程序繼續執行。

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 14 題5 分

Choose the correct statements from the multiple choices.

(A) Each container includes the application, the necessary binaries and libraries, and an entire guest operating system.

(B) Containers running on a single machine all share the same operating system kernel.

(C) Virtual machines run as isolated processes in user space on the host operating system.

(D) Containers are lightweight than virtual machines.

(E) None of the above.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考容器(container)與虛擬機器(virtual machine, VM)的隔離方式,以及兩者與作業系統核心的關係。

容器透過作業系統層級的虛擬化,隔離應用程式及其執行環境;同一主機上的容器共用主機的作業系統核心。虛擬機器則透過虛擬機器監控器(hypervisor)模擬硬體,每台 VM 可執行自己的客體作業系統(guest OS)。

解題方法

逐項比對容器與 VM 的差異:容器通常封裝應用程式及其相依的二進位檔、函式庫,但不包含一套完整的客體作業系統;VM 則包含完整的客體作業系統。因此,共用核心、是否包含客體作業系統,以及資源開銷,是判斷選項的關鍵。

選項分析

  • (A) 錯誤。 容器會包含應用程式及其所需的二進位檔、函式庫等,但不會各自包含完整的客體作業系統。容器共用主機的作業系統核心。
  • **(B) 正確。
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 15 題5 分

Choose the correct statements from the multiple choices.

(A) It is not allowed for routers to fragment IPv6 packets.

(B) DHCP allows a host to dynamically obtain its IP address from a network server when it joins the network.

(C) NAT is used to translate IP addresses to hardware addresses.

(D) DNS is used to find the hardware address of a local device.

(E) None of the above.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考查網路層與應用層常見協定的功能,以及 IPv6 封包分片的規則:

  • IPv6 分片:路由器不會替 IPv6 封包分片;若封包太大,來源主機可使用 IPv6 Fragment 擴充標頭進行分片。
  • DHCP:讓主機向網路中的 DHCP 伺服器動態取得 IP 位址及其他網路設定。
  • NAT:轉換 IP 位址,常見用途是讓多台內部主機共用公用 IP 位址。
  • DNS:將網域名稱解析為 IP 位址。
  • 硬體位址解析:IPv4 通常使用 ARP 將 IP 位址解析成 MAC 位址;IPv6 則使用 Neighbor Discovery Protocol。

解題方法

逐一對照各協定的標準用途,並區分兩組容易混淆的映射:

  • DNS:網域名稱 →\rightarrow IP 位址
  • ARP/Neighbor Discovery:IP 位址 →\rightarrow MAC 位址

再確認 IPv6 的分片由來源主機處理,而非路由器處理,即可判斷各選項。

選項分析

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 16 題5 分

When communicating with sockets, a client process initiates a request for a connection and is assigned a port by the host computer. Which of the following would be a valid port assignment for the host computer?

(A) 21

(B) 23

(C) 80

(D) 1625

(E) None of the above.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

TCP/UDP 連線由「IP 位址+埠號」識別。伺服器通常在固定的知名埠等待連線;用戶端發起連線時,作業系統會替用戶端程序選一個可用的臨時埠。埠號範圍是 00 至 6553565535;依本題採用的傳統分類,00 至 10231023 是知名埠,臨時埠通常選在 10231023 以上。

解題方法

逐一判斷選項是否為常見服務的知名埠,再確認是否大於 10231023。用戶端臨時埠由作業系統選取,並非使用伺服器等待連線時常見的固定服務埠。

選項分析

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 17 題5 分

____ is/are not a technique/s for handling critical sections in operating systems.

(A) Nonpreemptive kernels

(B) Preemptive kernels

(C) Spinlocks

(D) Peterson’s solution

(E) Dekker’s algorithm

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

臨界區(critical section)問題:多個行程共享資料時,要保證同一時間只有一個行程在臨界區內。課本(Silberschatz《Operating System Concepts》)把相關方法分成兩類:

  1. 作業系統核心層級的兩種一般作法:可搶先核心(preemptive kernel)與不可搶先核心(nonpreemptive kernel)。
  2. 同步機制/演算法:軟體解法(Peterson's solution、Dekker's algorithm)、硬體支援(test-and-set、compare-and-swap)、以及建立在其上的 mutex lock、spinlock、semaphore 等。

選項分析

  • (A) Nonpreemptive kernels:是處理方法。 核心模式下的行程不會被搶先,同一時間核心中只有一個行程在跑,核心資料結構自然沒有競爭條件。
  • **(B) Preemptive kernels:課本也將它列為一般作法之一。
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 18 題5 分

Assume a system has a TLB hit ratio of 90%. It requires 15 nanoseconds to access the TLB, and 85 nanoseconds to access main memory. What is the effective memory access time in nanoseconds for this system?

(A) 108.5

(B) 100

(C) 22

(D) 176.5

(E) 32

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

有效記憶體存取時間(EAT)是依 TLB 命中與未命中的機率,計算平均存取時間。

  • TLB 命中:先存取 TLB,再存取一次主記憶體。
  • TLB 未命中:先存取 TLB,再從主記憶體查頁表,最後存取目標資料,共存取主記憶體兩次。

解題方法

命中率為 0.90.9,未命中率為 1−0.9=0.11-0.9=0.1。

命中時的存取時間:

15+85=100 ns15+85=100\text{ ns}

未命中時的存取時間:

15+2(85)=185 ns15+2(85)=185\text{ ns}

因此有效存取時間為:

EAT=0.9(100)+0.1(185)=90+18.5=108.5 ns\text{EAT}=0.9(100)+0.1(185)=90+18.5=108.5\text{ ns}

選項分析

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 19 題5 分

Given the reference string of page accesses 1,2,3,4,2,3,4,1,2,1,1,3,1,41,2,3,4,2,3,4,1,2,1,1,3,1,4 and a system with three page frames, what is the final configuration of the three frames after the LRU algorithm is applied? Assume the FIFO queue is left out right in.

(A) 1,3,41,3,4

(B) 3,1,43,1,4

(C) 4,1,24,1,2

(D) 1,2,31,2,3

(E) 1,4,31,4,3

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

LRU(Least Recently Used,最近最少使用)在發生缺頁、且頁框已滿時,會淘汰「距離現在最久沒有被存取」的頁面。命中頁面也要更新其最近使用順序。

依題目「左側淘汰、右側加入」的表示方式,將 LRU 順序由左至右記為「最久未使用 → 最近使用」。

解題方法

依序處理每個頁面參照:頁面不在頁框中時,若頁框已滿,就淘汰 LRU 順序最左側的頁面;若頁面已在頁框中,則將它移到順序最右側。

參照頁面處理結果LRU 順序(最久未用 → 最近使用)
1載入1
2載入1, 2
3載入1, 2, 3
4缺頁,淘汰 12, 3, 4
2命中3, 4, 2
3命中4, 2, 3
4命中2, 3, 4
1缺頁,淘汰 23, 4, 1
2缺頁,淘汰 34, 1, 2
1命中4, 2, 1
1命中4, 2, 1
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 20 題5 分

Which of the following is true of a blocking system call?

(A) The application continues to execute its code when the call is issued.

(B) The call returns immediately without waiting for the I/O to complete.

(C) The execution of the application is suspended when the call is issued.

(D) Blocking application code is harder to understand than nonblocking application code.

(E) None of the above.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

阻塞式系統呼叫(blocking system call)會讓呼叫它的執行緒或行程等待操作完成。在等待期間,呼叫端的程式執行會暫停;作業系統可安排其他可執行的行程使用處理器。操作完成後,系統呼叫才返回,呼叫端接續執行。

解題方法

判斷關鍵在於:系統呼叫發出後,呼叫端是否能繼續執行後續程式碼。若呼叫端必須等操作完成才能返回,便是阻塞式呼叫;因此,呼叫端的執行會暫停。

選項分析

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

其他考古題