快轉到主要內容

《作業系統》期末考複習 — 選擇題篇

·825 字
目錄
大三上學期期末考複習 - 本文章屬於一個系列🍒。
◆ : 你在這裡!

⭐ 題目出自考古題

選擇題
#

🌋1. A race condition ____.
#

  • (A). results when several threads try to access the same data concurrently
  • (B). results when several threads try to access and modify ( 修改 ) the same data concurrently
  • (C). will result only if the outcome of execution does not depend on the order in which instructions are executed
  • (D). None of the above

💣答案 : (B)

⭐ Race Condition : 多個執行緒或行程同時存取並修改共享資源,結果會依執行順序不同而產生不一致結果的情況。


🌋2. A solution to ( 解決 ) the critical section problem does not have to satisfy ( 不必滿足 ) which of the following requirements?
#

  • (A). mutual exclusiony
  • (B). atomicity ( 原子性 )
  • (C). progress
  • (D). bounded

💣答案 : (B)


🌋3. How many philosophers may eat simultaneously ( 同時用餐 ) in the Dining Philosophers problem ( 哲學家用餐問題 ) with 5 philosophers?
#

  • (A). 2
  • (B). 3
  • (C). 5
  • (D). 1

💣答案 : (A)


🌋4. When using semaphores ( 號誌 ), a process invokes the wait() operation before accessing its critical section ( 臨界區之前 ), followed by the signal() operation upon completion of its critical section ( 臨界區工作後 ). Consider reversing the order of these two operations first calling signal(), then calling wait() ( 把順序顛倒過來 ). What would be a possible outcome of this?
#

  • (A).Starvation is possible.
  • (B).Several processes could be active ( 多個行程進入臨界區段 ) in their critical sections at the same time ( 同時 ).
  • (C). Deadlock is possible.
  • (D).Mutual exclusion is still assured.

💣答案 : (B)


🌋5. A deadlocked ( 死結 ) state occurs ( 發生 ) whenever ____.
#

  • (A).every process in a set is waiting ( 等待 ) for an event that can only be caused by another process in the set ( 只能由該組中另一個行程」所觸發的事件 )
  • (B).a process is unable to release its request for a resource after use
  • (C).the system has no available free resources
  • (D).a process is waiting for I/O to a device that does not exist

💣答案 : (A)


🌋6. Which of the following statements is true?
#

  • (A).A safe state may lead to a deadlocked state.
  • (B).An unsafe state is necessarily, and by definition, always a deadlocked state.
  • (C).An unsafe state ( 不安全狀態 ) may lead to a deadlocked state ( 死結 ).
  • (D).A safe state is a deadlocked state.

💣答案 : (C)


🌋7. A _____ could be preempted ( 搶先 ) from a process.
#

  • (A).mutex lock
  • (B).CPU
  • (C).semaphore
  • (D).file lock

💣答案 : (B)


🌋8. _____ is the method of binding ( 綁定 ) instructions and data to memory performed by most general-purpose operating systems.
#

  • (A).Load-time binding
  • (B).Interrupt binding
  • (C).Compile time binding
  • (D).Execution time (執行時期) binding

💣答案 : (D)


🌋9. Suppose a program is operating with execution-time binding and the physical address ( 實體位址 ) generated is 300. The relocation register is set to 100. What is the corresponding logical address ( 邏輯位址 )?
#

  • (A).199
  • (B).201
  • (C).200
  • (D).300

💣答案 : (C)

🚀解釋 :

  • \[\text{實體位址 (Physical Address)} = \text{邏輯位址 (Logical Address)} + \text{重定位暫存器 (Relocation Register)}\]
  • \[300 = \text{Logical Address} + 100\]
  • \[\text{Logical Address} = 300 - 100 = \mathbf{200}\]

🌋10. 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 ( 有效記憶體存取時間 EMAT ) in nanoseconds for this system?
#

  • (A).176.5
  • (B).108.5
  • (C).22
  • (D).100

💣答案 : (B)

🚀解釋 :

  • 情況 1:運氣好 (TLB Hit)
    • 過程:查 TLB (15ns) \(\rightarrow\) 找到了!直接去記憶體抓資料 (85ns)。
    • 花費時間:\(15 + 85 = \mathbf{100 \text{ ns}}\)
  • 情況 2:運氣不好 (TLB Miss)
    • 過程: 查 TLB (15ns) \(\rightarrow\) 沒找到… \(\rightarrow\) 去記憶體查 Page Table (85ns) \(\rightarrow\) 拿到地址後,再去記憶體抓資料 (85ns)。
    • 重點: Miss 的時候,你需要訪問記憶體 2次 (一次查表,一次抓資料)。
    • 花費時間: \(15 + 85 + 85 = \mathbf{185 \text{ ns}}\)
\[EMAT = (\text{Hit 機率} \times \text{Hit 時間}) + (\text{Miss 機率} \times \text{Miss 時間})\]

\[EMAT = 0.9 \times (15 + 85) + 0.1 \times (15 + 85 + 85)\]
  1. Hit 部分:\(0.9 \times 100 = \mathbf{90}\)
  2. Miss 部分:\(0.1 \times 185 = \mathbf{18.5}\)
  3. 加總:\(90 + 18.5 = \mathbf{108.5 \text{ ns}}\)

🌋11. _____ is the algorithm implemented on most systems.
#

  • (A).Least frequently used
  • (B).Most frequently used
  • (C).LRU
  • (D).FIFO

💣答案 : (C)


🌋12. Optimal page replacement ( 最佳頁面置換演算法 ) ____.
#

  • (A).can suffer from Belady’s anomaly
  • (B).requires that the system keep track of previously used pages
  • (C).is the page-replacement algorithm most often implemented
  • (D).is used mostly for comparison with ( 比較 ) other page-replacement schemes

💣答案 : (D)

⭐ OPT ( Optimal page replacement )需要未來視,在現實世界是不可能做到的,但它是理論上的天花板,所以都是用來評估某個置換演算法。


🌋13. ________ allows the parent and child processes to initially share the same pages ( 相同的頁 ), but when either process modifies ( 修改 ) a page, a copy of the shared page is created.
#

  • (A).virtual memory fork
  • (B).copy-on-write
  • (C).zero-fill-on-demand
  • (D).memory-mapped

💣答案 : (B)


🌋14. _____ occurs when a process spends more time paging than executing ( 執行 ).
#

  • (A).Thrashing
  • (B).Demand paging
  • (C).Memory-mapping
  • (D).Swapping

💣答案 : (A)


🌋15. The _____ is an approximation of a program’s locality ( 程式區域性 ).
#

  • (A).working set
  • (B).page fault frequency
  • (C).page replacement algorithm
  • (D).locality model

💣答案 : (A)


大三上學期期末考複習 - 本文章屬於一個系列🍒。
◆ : 你在這裡!

相關文章