WorksheetsDeadlocks
Total questions: 25
Worksheet time: 2hrs 5mins
When a process is rolled back as a result of deadlock the difficulty which arises is
starvation
system through put
low device utilization
cycle stealing
A computer system uses the bankers algoritt to deal with deadlocks. It's current state shown in the table below, where P0, P1, P2, P3 are processes and A, B and C are resource types.
Which of the following are safe sequences?
A: P1, P0, P2, P3
B: P1, P2, P3, P0
C: P1, P3, P0, P2
A and B
A and C
A,B,C
B and C
Which of the following statements are TRUE?
A : If resource pre-emption is allowed, then deadlock can be avoided but cannot be prevented.
B: If the number of sharable resources is greater than the number of processes, then deadlock can be prevented.
C : Deadlock can be prevented by not allowing any process to request for resources when it enters a critical section.
D : Deadlock avoidance schemes require information concerning which resource a process will request and use during its life time.
A, D
A, B
A, B, C
D
A system has P processes and R identical units of a re-usable resource. If each process can claim at most N units of the resource, then system will be deadlock free if and only if.
R >= P(N-1) + 1
R <= P(N-1) + 1
R >= P(N-1)
R = P(N-1) + 1
Which of the following is the solution of priority inversion problem?
(a) Kill the higher-priority process
(b) Kill the lower priority process
(c) Priority-Inheritance protocol.
(d) Semaphore.
Consider P = {P1, P2, P3}, R = {R1 , R2, R3, R4} one instance of resource type R1 , two instances of resource type R2, one instance of resource type R3 and three instances of resource type R4. The situation is P1 is holding an instance of R2 and waiting for an instance of R1, P2 is holding an instance of R1 , one instance of R2 and waiting for an instance of R3 and P3 is holding an instance of R3
a). Deadlock will not occur
b). Deadlock will occur
c). All the Instances Of R4 are by the processes
d). All the instances of R2 are not allotted.
Consider a system with 4 types of resources R1 (3 units), R2 (2 units), R3 (3 units), R4 (2 units). A non-preemptive resource allocation policy is used. At any given instance, a request is not entertained if it cannot be completely satisfied. Three processes P1, P2, P3 request the sources as follows if executed independently.
Which one of the following statements is TRUE if all three processes run concurrently starting at time t=0?
(A) All processes will finish without any deadlock
(B) Only P1 and P2 will be in deadlock.
(C) Only P1 and P3 will be in a deadlock.
(D) All three processes will be in deadlock
Assume a system with 4 resources, C = (6, 4, 4, 2). The maximum claim, table and the resource allocation tables are given below.
Find whether the state is safe or not?
(a) unsafe state
(b) safe state
(c) deadlock
(d) none of the above
Consider the following snapshot of a system running n processes. Process i is holding Xi instances of a resource R, 1 <= i <= n. currently, all instances of R are occupied. Further, for all i, process i has placed a request for an additional Yi instances while holding the Xi instances it already has. There are exactly two processes p and q such that Yp = Yq = 0. Which one of the following can serve as a necessary condition to guarantee that the system is not approaching a deadlock?
(A) min (Xp, Xq) < max (Yk) where k != p and k != q
(B) Xp + Xq >= min (Yk) where k != p and k != q
(C) max (Xp, Xq) > 1
(D) min (Xp, Xq) > 1
Which of the following is NOT true of deadlock prevention and deadlock avoidance schemes?
(a) In deadlock prevention, the request for resources is always granted if the resulting state is safe.
(b) In deadlock avoidance, the request for resources is always granted if the resulting state is safe.
(c) Deadlock avoidance is less restrictive than deadlock prevention
(d) Deadlock avoidance requires knowledge of resource requirements a priori.
An operating system implements a policy that require a process to release all resources before making a request for another resource. Select the TRUE statement from the following.
Both starvation and deadlock can occur
Starvation can occur but deadlock cannot occur
Starvation cannot occur but deadlock can occur
Neither starvation nor deadlock can occur.
Suppose n processes, P1, …. Pn share m identical resource units, which can be reserved and released one at a time. The maximum resource requirement of process Pi is Si, where Si > 0. Which one of the following is a sufficient condition for ensuring that deadlock does not occur?
(options are in the picture)
A
B
C
D
A system has n resources R0,…,Rn-1,and k processes P0,….Pk-1.The implementation of the resource request logic of each process Pi is as follows:
In which one of the following situations is a deadlock possible?
(A) n=40, k=26
(B) n=21, k=12
(C) n=20, k=10
(D) n=41, k=19
A single processor system has three resource types x, y, z, which are shared by three processes. There are 5 units of each resource type. Consider the following scenario, where the column allow denotes the number of units of each resource type allocated to each process,
and the column request denotes the number of units of each resource type requested by a
process in order to complete execution. Which of these processes will finish LAST?
P0
P1
P2
None
A multithreaded program P executes with x number of threads and uses y number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e., if a thread holds a lock l, then it cannot re-acquire lock l without releasing it. If a thread is unable to acquire a lock, it blocks until the lock becomes available. The minimumvalue of x and the minimum value of y together for which execution of P can result in a deadlock are:
(A) x = 1, y = 2
(B) x = 2, y = 1
(C) x = 2, y = 2
(D) x = 1, y = 1
Consider a system having “n” resources of same type. These resources are shared by 3 processes, A, B, C. These have peak demands of 3, 4, and 6 respectively. For what value of “n” deadlock won’t occur
15
9
10
11
A computer system has 6 tape drives with n processes competing for them. Each process may need 3 tape drives. The maximum value of n for which the system is guaranteed to be deadlock free is
1
2
3
4
An operating system contains 3 user processes each requiring 2 units of resources R. The minimum number of units of R such that no dead locks will ever arise is
3
5
4
6
Consider a system with 3 processes that share 4 instances of the same resource type. Each process can request a maximum of K instances. Resource instances can be requested and released only one at a time. The largest value of K that will always avoid deadlock is (a) .
Consider the following policies for preventing deadlock in a system with mutually exclusive resources.
I. Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released.
II. The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers.
III. The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers.
IV. The resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resources.
Which of the above policies can be used for preventing deadlock?
(A) Any one of I and III but not II or IV
(B) Any one of I, III and IV but not II
(C) Any one of II and III but not I or IV
(D) Any one of I, II, III and IV
A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for 3 processes are shown below:
Which of the following best describes the current state of the system?
(A) Safe, Deadlocked
(B) Safe, Not Deadlocked
(C) Not Safe, Deadlocked
(D) Not Safe, Not Deadlocked
If a system has total of 150 units of resource , identify which of the following values of X and Y the above system will be in safe state?
1. X = 40 , Y = 20
2. X = 50 , Y = 10
3. X = 30 , Y = 20
4. X = 20 , Y = 30
Consider the following snapshot of a system with 5 processes and 3 resources:
If the system has 1 unit of R1 and 1 unit of R3 available then how many minimum resource units available for R2 to guarantee deadlock free?
0
1
2
3
Assume a system with 4 resources, C = (6, 4, 4, 2). The maximum claim, table and the resource allocation tables are given below.
What happens if the resource allocator allocates 1 instance of R0 and 1 instance of R1 to the process P3
Results in deadlock state
Results in an unsafe state
Results in a safe state
None of the above
Given the following system with four processes 1 to 4 and four resources A, B, C, D for what values of 'x' is the system in a safe state.
x < 3
x > 7
3 <= x <= 7
x = 0
