Download B - 周清江副教授

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

CP/M wikipedia , lookup

Spring (operating system) wikipedia , lookup

Distributed operating system wikipedia , lookup

Burroughs MCP wikipedia , lookup

DNIX wikipedia , lookup

Thread (computing) wikipedia , lookup

Process management (computing) wikipedia , lookup

Transcript
淡江大學
考試科目: 作業系統
97
學年度第 1 學期 期中 考試命題紙
開課班別:
資管
系 3 年 B 班 命題教授: 周清江
考試日期: 11 月 14 日
(星期 五 )
第4
本試題共 3 頁,印刷份數: 70 份
備註:
(B5 白紙)或答案紙請在試題內封袋備註。
節 ※ 請務必註記,准帶項目打「V」,否則打「X」。1.需加發計算紙
2.本命題紙為A4 大小,印刷格式統一由闈場判斷是否放大
計算機
x
課本
筆記
x
x
字 典
電子辭典
其他
或合併印刷,如有特殊需求,請註記:
x
一、選擇題:(32 分)
1. _____ is the fastest in the memory hierarchy. (A) cache (B) memory (C) register (D) disk.
2. A ____ can be used to prevent a user program from never returning control to the operating system.
(A) portal (B) program counter (C) firewall (D) timer
3. Embedded computers typically run on a ____ operating system.
(A) multimedia (B) real-time (C) handheld
(D) peer-to-peer
4. Which of the following is an example of a systems program? (A) command interpreter (B) web browser (C)
text formatter (D) database systems
5. A microkernel is a kernel ____. (A) containing many components that are optimized to reduce resident
memory size (B) that is compressed before loading in order to reduce its resident memory size (C) that is
compiled to produce the smallest size possible when stored to disk (D) that is stripped of all nonessential
components
6. A boot block ____. (A) typically is sophisticated enough to load the operating system and begin its
execution (B) typically only knows the location and length of the rest of the bootstrap program (C) is
composed of multiple disk blocks (D) is composed of multiple disk cylinders
7. Which of the following process state transition would not happen at all? (A) running to ready (B) waiting to
ready (C) ready to waiting (D) ready to running
8. A process control block ____. (A) includes information of the process's state (B) stores the address of the
next instruction to be processed by a different process (C) determines which process is to be executed next
(D) is an example of a process queue
9. What is the only way in UNIX to create a new process? (A) s = execve (name, argv, environp) (B) s =
mount (special, name, flag) (C) n = write (fd, buffer, nbytes) (D) pid = fork()
10. Which of the following is not used in communication between client and server systems? (A) socket (B)
shared memory (C) remote procedural call (D) remote method invocation of Java
11. The ____ multithreading model multiplexes many user-level threads to a smaller or equal number of
kernel threads. (A) many-to-one model (B) one-to-one model (C) many-to-many model (D) mant-to-some
model
12. Which of the following are items private to each thread? (A) stack (B) files (C) code (D) data
13. In the ________ scenario for thread cancellation, the target thread periodically checks whether it should
terminate, allowing it an opportunity to terminate itself in an orderly fashion. (A) Synchronous cancellation
(B) Asynchronous cancellation (D) Default cancellation (D) Deferred cancellation
14. Which of the following scheduling algorithms only has the nonpreemptive version? (A) shortest job first
(B) first-come first served (C) priority scheduling (D) multi-level queue scheduling
第1頁
注意:1、考試求公平及公正,請同學務必自律,維護學校與學生之榮譽。
2、考試時不得有交談、攜卷出場、窺視、傳遞、代考、夾帶等違規行為,違者將受嚴重議處。
淡江大學
考試科目: 作業系統
97
學年度第 1 學期 期中 考試命題紙
開課班別:
資管
系 3 年 B 班 命題教授: 周清江
考試日期: 11 月 14 日
(星期 五 )
第4
本試題共 3 頁,印刷份數: 70 份
備註:
(B5 白紙)或答案紙請在試題內封袋備註。
節 ※ 請務必註記,准帶項目打「V」,否則打「X」。1.需加發計算紙
2.本命題紙為A4 大小,印刷格式統一由闈場判斷是否放大
計算機
x
課本
筆記
x
x
字 典
電子辭典
其他
或合併印刷,如有特殊需求,請註記:
x
15. In measuring scheduling performance, which is the number of jobs per time unit that the system completes?
(A) response time (B) turnaround time (C) throughput (D) utilization rate
16. _______ If π means the original estimation time of a process and t means its actual execution time, we
could use α π + (1-α) t to estimate the next execution time of the process. If we would like to use the
actual execution time to be the estimated next execution time, then what value should α be? (A) 0 (B) 1/4
(C) 1/2 (D) 1
二、解釋名詞 (21 分)
1. cache coherency:
In multi-processor environment, each CPU contains a local cache. A copy of a data item may exist
simultaneously in several caches. We must make sure an update to the value of a data item in one cache is
immediately reflected in all other caches when that data item resides.
2. separation of policy from mechanism in OS design
Mechanisms determine how to do something; policies determine what will be done. A good OS design would
have a general mechanism insensitive to change in policy.
3. context switch
It is the task of OS for switching the CPU to another process. It requires performing a PCB state save of the
current process and a state restore of the next process.
4. upcall
The mechanism for the kernel-thread library to inform an application.
5. multilevel feedback-queue scheduling
It is a process scheduling algorithm that allows a process to move between queues. The idea is to separate
processes according to to the characteristics of their CPU bursts.
6. Little’s formula
In a steady state, the number of processes leaving the system is equal to the number of processes arriving the
system. n   W , where n is the average number of leaving processes,  is process arriving rate, and W is
average waiting time for a process.
7. race condition
A situation where several processes access and manipulate the same data concurrently and the outcome of the
execution depends on the particular order in which the access takes palce.
三、問答題 (57 分)
第2頁
注意:1、考試求公平及公正,請同學務必自律,維護學校與學生之榮譽。
2、考試時不得有交談、攜卷出場、窺視、傳遞、代考、夾帶等違規行為,違者將受嚴重議處。
淡江大學
考試科目: 作業系統
97
學年度第 1 學期 期中 考試命題紙
開課班別:
資管
系 3 年 B 班 命題教授: 周清江
考試日期: 11 月 14 日
(星期 五 )
第4
本試題共 3 頁,印刷份數: 70 份
備註:
(B5 白紙)或答案紙請在試題內封袋備註。
節 ※ 請務必註記,准帶項目打「V」,否則打「X」。1.需加發計算紙
2.本命題紙為A4 大小,印刷格式統一由闈場判斷是否放大
計算機
x
課本
筆記
x
x
字 典
電子辭典
其他
或合併印刷,如有特殊需求,請註記:
x
1. What are the three main purposes of an operating system? (6 分)
2. What is the purpose of interrupts? What is the difference between a trap and an interrupt? (4 分)
When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fixed location.
An interrupt could be from hardware or software, while a trap is always software generated.
3. What is the purpose of the command interpreter? Why is it usually separate from the kernel? (4 分)
4. In what ways is the modular kernel approach similar to the layered approach? In what ways does it differ
from the layered approach? (4 分)
(a) Each kernel section has defined protected interfaces.
(b) Modular kernel approach is more flexible in that any module can call any other module.
5. Assume that a distributed system is susceptible (易於) to server failure. What mechanisms would be
required to guarantee the “exactly once” semantics for execution of RPCs? (5 分)
6. What are the benefits and disadvantages of the following:
(a) direct or indirect communication
(b) synchronous or asynchronous communication
(6 分)
第3頁
注意:1、考試求公平及公正,請同學務必自律,維護學校與學生之榮譽。
2、考試時不得有交談、攜卷出場、窺視、傳遞、代考、夾帶等違規行為,違者將受嚴重議處。
淡江大學
考試科目: 作業系統
97
學年度第 1 學期 期中 考試命題紙
開課班別:
資管
系 3 年 B 班 命題教授: 周清江
考試日期: 11 月 14 日
(星期 五 )
第4
本試題共 3 頁,印刷份數: 70 份
備註:
(B5 白紙)或答案紙請在試題內封袋備註。
節 ※ 請務必註記,准帶項目打「V」,否則打「X」。1.需加發計算紙
2.本命題紙為A4 大小,印刷格式統一由闈場判斷是否放大
計算機
x
課本
筆記
x
x
字 典
電子辭典
其他
或合併印刷,如有特殊需求,請註記:
x
(a) Direct: benefit: symmetry in addressing; disadvantage: limited modularity of the resulting process
definitions
Indirect: benefit: a process can communicate with another process via different mailboxes; Disadvantage:
Two processes can communicate only if the processes have a shared mailbox.
(b) Synchronous: benefit: easy to program. disadvantage: long waiting
Asynchronous: benefit: short waiting. disadvantage: hard to program.
7. What are two differences between user-level threads and kernel-level threads? Under what circumstances
is one type better than the other? (6 分)
8. Suppose a system has 256 Mbytes memory. The operating system itself occupies 112 Mbytes, and each
process needs 48Mbytes to execute. Suppose a process in average spends 80% of time waiting for I/O. (a)
At most how many processes could be running at the same time? (b) In the case of (a), what is the CPU
utilization rate? (6 分)
(a) (256-112)/48=3
(b) 1-(0.80)3 = 0.488 = 48.8%
9. Suppose that the following processes arrive for execution at the same time. Each process will run the listed
amount of burst time.
Process
Burst Time
P1
2
P2
4
P3
6
(a) If the priority for P1 is 3, for P2 is 1, and for P3 is 2, draw the Gantt chart with the priority scheduling.
(Note: process with priority 1 has the highest priority) What is the average turnaround time?
(b) Draw the Gantt chart with the round-robin scheduling with time quantum 1. What is the average
waiting time?
(c) If the arrival time for P1 is 2, for P2 is 1, and for P3 is 0, draw the Gantt chart with the First Come First
Serve scheduling. What is the average response time?
第4頁
注意:1、考試求公平及公正,請同學務必自律,維護學校與學生之榮譽。
2、考試時不得有交談、攜卷出場、窺視、傳遞、代考、夾帶等違規行為,違者將受嚴重議處。
淡江大學
考試科目: 作業系統
97
學年度第 1 學期 期中 考試命題紙
開課班別:
資管
系 3 年 B 班 命題教授: 周清江
考試日期: 11 月 14 日
(星期 五 )
第4
本試題共 3 頁,印刷份數: 70 份
備註:
(B5 白紙)或答案紙請在試題內封袋備註。
節 ※ 請務必註記,准帶項目打「V」,否則打「X」。1.需加發計算紙
2.本命題紙為A4 大小,印刷格式統一由闈場判斷是否放大
計算機
x
課本
筆記
x
x
字 典
電子辭典
其他
或合併印刷,如有特殊需求,請註記:
x
(d) If the arrival time for P1 is 2, for P2 is 1, and for P3 is 0, draw the Gantt chart with the Shortest
Remaining Time First scheduling. What is the average waiting time?
(16 分)
第5頁
注意:1、考試求公平及公正,請同學務必自律,維護學校與學生之榮譽。
2、考試時不得有交談、攜卷出場、窺視、傳遞、代考、夾帶等違規行為,違者將受嚴重議處。