選擇題 (2 pt each):
(1) If a program terminates abnormally, a dump of memory may be examined by a ______ to determine the cause of the problem. A) module B) debugger C) shell D) control card
(2) A boot block ______. A) typically only knows the location and length of the rest of the bootstrap program B) typically is sophisticated enough to load the operating system and begin its execution C) is composed of multiple disk blocks D) is composed of multiple disk cylinders
(3) Which of the following statements is true? A) Shared memory is typically faster than message passing. B) Message passing is typically faster than shared memory. C) Message passing is most useful for exchanging large amounts of data. D) Shared memory is far more common in operating systems than message passing
(4) According to Amdahl's Law, what is the speedup gain for an application that is 60% parallel and we run it on a machine with 4 processing cores? A) 1.82 B) .7 C) .55 D) 1.43
(5) Which of the following is true of multilevel queue scheduling? A) Processes can move between queues. B) Each queue has its own scheduling algorithm. C) A queue cannot have absolute priority over lower-priority queues. D) It is the most general CPU-scheduling algorithm.
(6) ______ occurs when a higher-priority process needs to access a data structure that is currently being accessed by a lower-priority process. A) A race condition B) Deadlock C) Priority inversion D) A critical section
(7) How many philosophers may eat simultaneously in the Dining Philosophers problem with 5 philosophers? A) 1 B) 2 C) 3 D) 5
(8) Suppose that there are ten resources available to three processes. At time 0, the following data is collected. The table indicates the process, the maximum number of resources needed by the process, and the number of resources currently owned by each process. Which of the following correctly characterizes this state?
| Process | Maximum Needs | Currently Owned |
|---|---|---|
| P₀ | 10 | 4 |
| P₁ | 3 | 1 |
| P₂ | 6 | 4 |
A) It is safe. B) It is not safe. C) The state cannot be determined. D) It is an impossible state.
(9) 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) 22 B) 100 C) 108.5 D) 176.5
(10) Suppose that the operating system uses two internal tables to keep track of open files. Process A has two files open and process B has three files open. Two files are shared between the two processes. How many entries are in the per-process table of process A, the per-process table of process B, and the system-wide tables, respectively? A) 5, 5, 5 B) 2, 3, 3 C) 2, 3, 5 D) 2, 3, 1
(1) 異常結束時的 memory dump 丟進 debugger 才看得到當下的暫存器與變數 → B
(2) boot block 只放得下一小段程式,只知道剩下那段 bootstrap program 在哪、多長,把它載進來後再由它載入 OS → A
(3) shared memory 建好之後直接讀寫同一塊記憶體,不用每次進 kernel;message passing 每次都要 system call,適合小量資料與跨機器 → A
(4) \(S=\dfrac1{(1-f)+f/k}=\dfrac1{0.4+0.6/4}=\dfrac1{0.55}\approx1.82\) → A
(5) multilevel queue 把 process 依性質固定分進不同 queue,每個 queue 可有自己的排班演算法;process 不能在 queue 間移動(那是 feedback queue) → B
(6) 高優先權 process 卡在低優先權 process 持有的資料結構上 → priority inversion → C
(7) 每人要同時拿到左右兩支筷子,5 支最多支援 \(\lfloor5/2\rfloor=2\) 人同時吃 → B
(8) 已配出 \(4+1+4=9\),available \(=10-9=1\);各自還需要:P₀ 6、P₁ 2、P₂ 2,都大於 1,沒有任何一個能先跑完,找不到 safe sequence → unsafe → B
(9) hit:\(15+85=100\);miss:\(15+85+85=185\)(查 TLB、讀 page table、讀記憶體)
\(\text{EMAT}=0.9\times100+0.1\times185=108.5\) ns → C
(10) per-process table:A 有 2 筆、B 有 3 筆;system-wide table 每個被開啟的檔案一筆,兩邊共 5 個開啟、其中 2 個是同一檔案,所以 \(2+3-2=3\) 筆 → B
(1) B (2) A (3) A (4) A (5) B (6) C (7) B (8) B (9) C (10) B