1
2
Program a simulation of the banker’s algorithm. Your program should cycle through each of the bank clients asking for a request and evaluating whether it is safe or unsafe. Output a log of requests and decisions to a file.
3
Assume two processes are issuing a seek command to reposition the mechanism to access the disk and enable a read command. Each process is interrupted before executing its read, and discovers that the other has moved the disk arm. Each then reissues the seek ... . This sequence continually repeats. Is this a resource deadlock or a livelock? What methods would you recommend to handle the anomaly?
4
Explain the differences between deadlock, livelock, and starvation.
5
Main memory units are preempted in swapping and virtual memory systems. The processor is preempted in time-sharing environments. Do you think that these preemption methods were developed to handle resource deadlock or for other purposes? How high is their overhead?
6
A computer science student assigned to work on deadlocks thinks of the following brilliant way to eliminate deadlocks. When a process requests a resource, it specifies a time limit. If the process blocks because the resource is not available, a timer is started. If the ... the process is released and allowed to run again. If you were the professor, what grade would you give this proposal and why?
7
One way to prevent deadlocks is to eliminate the hold-and-wait condition. In the text it was proposed that before asking for a new resource, a process must first release whatever resources it already holds (assuming that is possible). However, doing so introduces ... that it may get the new resource but lose some of the existing ones to competing processes. Propose an improvement to this scheme.
8
In an electronic funds transfer system, there are hundreds of identical processes that work as follows. Each process reads an input line specifying an amount of money, the account to be credited, and the account to be debited. Then it locks both accounts and transfers ... . (In other words, solutions that lock one account and then release it immediately if the other is locked are not allowed.)
9
Two processes, $A$ and $B,$ each need three records, $1, 2,$ and $3,$ in a database. If $A$ asks for them in the order $1, 2, 3,$ and $B$ asks for them in the same order, deadlock is not possible. However, if $B$ asks for them ... resources, there are $3!$ or six possible combinations in which each process can request them. What fraction of all the combinations is guaranteed to be deadlock free?
10
One way to eliminate circular wait is to have rule saying that a process is entitled only to a single resource at any moment. Give an example to show that this restriction is unacceptable in many cases.
11
A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows: What is the smallest value of x for which this is a safe state?
12
The banker’s algorithm is being run in a system with $m$ resource classes and $n$ processes. In the limit of large $m$ and $n,$ the number of operations that must be performed to check a state for safety is proportional to $m^{a} n^{b}.$ What are the values of $a$ and $b?$
13
Suppose that process $A$ in Fig. 6-12 requests the last tape drive. Does this action lead to a deadlock?
14
Consider the previous problem again, but now with $p$ processes each needing a maximum of $m$ resources and a total of $r$ resources available. What condition must hold to make the system deadlock free?
15
A system has two processes and three identical resources. Each process needs a maximum of two resources. Is deadlock possible? Explain your answer.
16
Take a careful look at Fig. 6-11(b). If $D$ asks for one more unit, does this lead to a safe state or an unsafe one? What if the request came from $C$ instead of $D?$
1 vote
17
Can a system be in a state that is neither deadlocked nor safe? If so, give an example. If not, prove that all states are either deadlocked or safe.
18
In theory, resource trajectory graphs could be used to avoid deadlocks. By clever scheduling, the operating system could avoid unsafe regions. Is there a practical way of actually doing this?
19
Can the resource trajectory scheme of Fig. 6-8 also be used to illustrate the problem of deadlocks with three processes and three resources? If so, how can this be done? If not, why not?
20
All the trajectories in Fig. 6-8 are horizontal or vertical. Can you envision any circumstances in which diagonal trajectories are also possible?
21
Suppose that in Fig. 6-6 $C_{ij} + R_{ij} > E_{j}$ for some i. What implications does this have for the system?
22
Explain how the system can recover from the deadlock in previous problem using recovery through preemption. recovery through rollback. recovery through killing processes.
23
Consider the following state of a system with four processes$, P1, P2, P3,$ and $P4,$ and five types of resources, $RS1, RS2, RS3, RS4,$ and $RS5:$ Using the deadlock detection algorithm described in Section $6.4.2,$ show that there is a deadlock in the system. Identify the processes that are deadlocked.
24
The discussion of the ostrich algorithm mentions the possibility of process-table slots or other system tables filling up. Can you suggest a way to enable a system administrator to recover from such a situation?
25
In order to control traffic, a network router, $A$ periodically sends a message to its neighbor, $B,$ telling it to increase or decrease the number of packets that it can handle. At some point in time, Router $A$ is flooded with traffic and sends $B$ a message ... size from $0$ to a positive number. That message is lost. As described, neither side will ever transmit. What type of deadlock is this?
1 vote
26
Suppose that there is a resource deadlock in a system. Give an example to show that the set of processes deadlocked can include processes that are not in the circular chain in the corresponding resource allocation graph.
27
Suppose four cars each approach an intersection from four different directions simultaneously. Each corner of the intersection has a stop sign. Assume that traffic regulations require that when two cars approach adjacent stop signs at the same time, the car on the left must ... (indefinitely) for the car on the left to proceed. Is this anomaly a communication deadlock? Is it a resource deadlock?
A computer has six tape drives with $n$ processes competing for them. Each process may need two drives. What is the maximum value of $n$ for the system to be deadlock free? $5$ $4$ $3$ $6$
Consider the following snapshot of a system: $Allocation$ $Max$ $Available$ $A$ $B$ $C$ $D$ $A$ $B$ $C$ $D$ $A$ $B$ $C$ $D$ $P_0$ $2$ $0$ $0$ $1$ $4$ $2$ $1$ $2$ $3$ $3$ $2$ $1$ $P_1$ $3$ $1$ $2$ $1$ $5$ $2$ $5$ $2$ $P_2$ ... for $(1, 1, 0, 0)$, can the request be granted immediately ? $c$. If a request from process $P_4$ arrives for $(0, 0, 2, 0)$, can the request be granted immediately?