| 一. | Please answer the following deadlock questions. (14%)
- Please list four necessary conditions for the deadlock. (4%)
- Is it possible to have a deadlock involving only one single process? Why? (3%)
- Why recovery from deadlock is made difficult? (4%)
- List one example of deadlock that is not related to a computer system environment. (3%)
|
| 二. | Consider the reference page sequence is 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5, and the number of page frames is 4. (9%)
- How many page faults for FIFO algorithm? (3%)
- Suppose we decrease page frames to 3, how many page faults for FIFO algorithm? (3%)
- What phenomenon will occur? (3%)
|
| 三. | Under ETHERNET topology, stations use CSMA/CD method to send message. (8%)
- What is CSMA/CD? (4%)
- It needs 2t time to detect whether the message collision with the others, why? (4%)
|
| 四. | How should a programmer decide whether to use a macro or a function to accomplish a given logical function? (6%) |
| 五. | Consider the precedence matrix and grammar of operator precedence parser. (14%)
Grammar G(E) :

Precedence Matrix :

- Parse the id + id * id and also show the parsing tree. (6%)
- Parse the id * id id. (4%)
- Is the grammar G(E) an unambiguous? Why? (4%)
|
| 六. | Please answer the following multilevel feedback queue scheduling questions. (18%)
- Explain the multilevel feedback queue algorithm. (6%)
- What advantage is there in having different time slice on different levels? (3%)
- What would be the effect of setting the time slice at a very large value? (3%)
- What if the time slice is set to a very small value? (3%)
- What would be the effect of CPU bound processes? (3%)
|
| 七. | Several new operating systems provide thread facility, and also provide traditional process facility. (16%)
- Describe the differences between thread and process. (6%)
- What major disadvantage do threads have? (3%)
- Give one example that would benefit from the use of threads, and one that would not. (4%)
- User level threads are faster to switch among than kernel threads, why? (3%)
|
| 八. | The bakery algorithm is shown in the following. (15%)
choosing[i]:=true;
number[i]:=max(number[0],number[1], …, number[n-1])+1;
choosing[i]:=false;
for j:= 0 to n-1
do begin
while choosing[j] do no-op;
while number[j]<>0 and (number[j],j) < (number[i],i) do no-op;
end;
CRITICAL SECTION
number[i]:=0;
- Please explain this algorithm. (8%)
- List three requirements to solve the critical section problem. (3%)
- Prove the bakery algorithm is correct. (4%)
|