※ 引述《Jerry (坦然)》之銘言:
1. Define the essential properties of the following types of operating
systems:
(1) Time-sharing (5%)
Multi-programmed, interactive
(2) Real-time (5%)
Bounded waiting time
(3) Parallel (5%)
Shared resource, shared memory, multi-CPU
(4) Distributed (5%)
Shared resource, communication, multi-entity
2. What changes, such as dual mode, should be made to the computer
architecture to ensure the 'correct' operation of the system? Please
state their essential roles. (10%)
Memory protection, I/O protection, CPU protection
3. Compare the buffering scheme with the spooling scheme. (10%)
spooling is more or less like a specialized buffering scheme.
It uses disk as buffer and the main purpose for the spooling controller
is to keep the moving of low-speed device while CPU can do other things.
Buffering is often done on higher-speed devices, such as RAM.
But can be used not only in spooling, but also in prefetching data
, saving temporiry information, etc.
扯不下去了 >_<
4. Please draw a diagram of process states and describe what state functions
are and when states change. (5%)
Please refer to Figure 4.1
5. Consider the following set of processes, with the length of the CPU burst
time given in milliseconds:
Process Burst Time Priority
----------------------------------
P1 10 3
P2 1 4
P3 2 3
P4 1 1
P5 5 2
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5,
all at time 0.
(1) Draw four Gantt charts illustrating the execution of these process
using FCFS, SJF, a non-preemptive priority (a smaller priority number
implies a higher priority), and RR (quantum = 1) scheduling. (12%)
FCFS P1(0,10),P2(10,11),P3(11,13),P4(13,14),P5(14,19)
SJF P2(0,1),P4(1,2),P3(2,4),P5(4,9),P1(9,19)
Pri P4(0,1),P5(1,6),P1(6,16),P3(16,18),P2(18,19)
RR P1(0,1),P2(1,2),P3(2,3),P4(3,4),P5(4,5),P1(5,6),P3(6,7),P5(7,8)
P1(8,9),P5(9,10),P1(10,11),P5(11,12),P1(12,13),P5(13,14)
P1(14 ...... 19)
(2) What is the turnaround time of each process for each of the scheduling
algorithms in part (1)? (4%)
FCFS (10+11+13+14+19) / 5
SJF (1+2+4+9+19) / 5
Pri (1+6+16+18+19) / 5
RR (19+2+7+4+14) / 5
(3) What is the waiting time of each proess for each of the scheduling
algorithms in part (1)? (4%)
懶得算了~~~
6. Define a critical-section problem and describe the three requirements to
solve the critical-section problem. (5%) Please state three algorithms in
only two process at a time to solve the critival-section problem. (15%)
Many processes contains a segment of code which no other process
is allowed to execute if it's inside. The segment is called
CS, and the problem is to design a protocol that performs entering
and exiting functions for processes to cooperate.
Three requirements are: Mutual Exclusion, Progressing, and
Bounded waiting time
It is believed that the answer to this question is to ask about
the three algorithms(using turn, using flag, and mixed) in the textbook.
Although Algorithm 1 and 2 don't satisfy all three requirements, it's
still suggested to choose them as our answer.
Other kinds of answers include semaphore, monitor, or hareware block
solutions for the implemntation of CS protocol. However, I believe
that they're all too complicated for this 15% problem.
7. Demonstrate the monitors, conditional critical regions, and semaphores
are all equivalent, insofar as the same types of synchronization problems
can be implemented with them. (15%)
Both monitors and conditional critical regions can be implemented
using semaphores. They only differ from level of views.
For a section of code that is conditionally critical, we can use
monitor.procedure xxx
begin
if (condition_x_is_false) x.wait;
....
end
to perform synchronization
or
region xxx when (condition_x_is_true) do ....
or
while (condition_x_is_false) do no_op;
sem.wait();
...
sem.signal();
Hence the same type of synchronization problem can be solved
by different kinds of tools.
--
狐狸說:「你為你的玫瑰耗掉很多時間,
你的玫瑰才變得如此重要!」
「人類已忘掉這個真理,可是你千萬別忘記。
你對自己馴服的東西永遠有責任,你該為你的玫瑰負責。」
--
※ 發信站: 批踢踢實業坊(ptt.twbbs.org)
◆ From: t199-237.dialup.