Beruflich Dokumente
Kultur Dokumente
Determinism
A requirement that processes maintain correct behavior, that is, their outputs are
determined only by their inputs, in spite of the actions of other processes. This is the key
goal of strategies focused on mutual exclusion, synchronization, and deadlock.
b)
Busy waiting
A strategy in which processes waiting for some condition repeatedly check the condition,
using processor time, instead of sleeping until they receive a signal indicating that the
condition is true.
c)
Monitor condition
A special data type in a monitor that accepts wait and signal operations but has
no memory. A wait operation places the calling process in a queue associated
with the condition and allows another process to use the monitor. A signal
operation releases the next waiting process, if any.
d)
e)
Ostrich algorithm
The strategy that deals with deadlock by ignoring it and hoping it does not happen often.
Based on the myth of an ostrich hiding its head in the sand.
-1-
2.
3.
4.
5. (10 points)
Are there any synchronization problems that can be solved with semaphores but not with
monitors? If so, give an example. If not, justify your answer.
NO -- each mechanism can solve exactly the same set of problems. To show this, note that
a monitor can be implemented using semaphores. Also, a semaphore can be implemented
using a monitor, although it may not be practical to do so.
6. (5 points)
Give one practical example of deadlock prevention in a computing system.
The Mutual Exclusion condition may be removed for printers by using spooling.
The Hold and Wait condition may be removed for memory by requiring all memory to
be allocated at once (not too practical but OK)
The No Preemption condition may be removed for memory by swapping.
The Circular Waiting condition may be removed for network channels by requiring
that they be requested in order.
(etc.)
7. (15 points)
Consider a system with three resource types and four processes. The system state is given
below. Is the system currently deadlocked? If not, show a sequence in which all processes can be
released. If so, identify the deadlocked processes.
ALLOCATED
p1
p2
p3
p4
A
0
1
1
0
B
1
1
0
0
C
0
0
0
2
REQUEST
A
0
0
0
0
B
0
2
1
2
C
1
0
2
0
AVAILABLE
A B C
0 0 1
The system is deadlocked. p1 can be removed; however, p2, p3, and p4 are all stuck.
END OF MONITOR
5.