Machine-translated by Google. Questions are authored in English.
Top

Deadlocks Questions and Answers

11.

Resources are allocated to the process on non-sharable basis is

Exam Year(s)

UGC NET - 2012,

Answer: A

Allocation of resources on a non-sharable basis is mutual exclusion.

The mutual exclusion condition says that at least one resource must be held in a non-sharable mode, so only one process at a time can use it. Hold and wait (B) means a process holds some resources while waiting for others, no pre-emption (C) means a resource cannot be taken from the process holding it, and circular wait (D) means a cycle of processes each waiting for a resource held by the next.

Please log in or register to report this question.

12.

Which of the following is scheme to deal with deadlock ?

Exam Year(s)

UGC NET - 2012,

Answer: A

A time out is a scheme for dealing with deadlock: if a transaction or process has waited longer than a set time for a lock or a resource, it is assumed to be deadlocked and is aborted or rolled back, so others can proceed. 'Time in' is not a deadlock scheme at all, so the option naming both is wrong, and the last option is wrong because time out is one. The answer is Time out, option (A), and the other methods, such as prevention and detection with a wait-for graph, are not among the options.

Please log in or register to report this question.

13.

Simplest way of deadlock recovery is

Exam Year(s)

UGC NET - 2013,

Answer: D

The simplest way of recovering from a deadlock is to kill one of the processes in the deadlock cycle, which releases the resources it holds so the others can continue. It needs no saved state and no checking of resource ownership.

Rolling back needs checkpoints to be saved earlier, preempting a resource needs the resource to be safely taken away and possibly restored, and "locking" a process would only add to the blocking. These are more complex or do not resolve the deadlock.

Please log in or register to report this question.

14.

Suppose S and Q are two semaphores initialized to 1. P1 and P2 are two processes which are sharing resources.

P1 has statementsP2 has statements
wait(S) ;wait(Q) ;
wait(Q) ;wait(S) ;
critical-section 1;critical-section 2;
signal(S) ;signal(Q) ;
signal(Q) ;signal(S) ;

Their execution may sometimes lead to an undesirable situation called

Exam Year(s)

UGC NET - 2013,

Answer: D

Their execution may sometimes lead to a deadlock, which is option (D). P1 takes S and then waits for Q, while P2 takes Q and then waits for S, so if each has taken its first semaphore both wait for ever for the other to release the second.

Starvation is the indefinite postponement of one process while others proceed, which is not the case here, since neither can proceed. A race condition needs unsynchronised access to shared data, and the semaphores prevent that, and multithreading is not an undesirable situation as such.

Please log in or register to report this question.

15.

An operating system using banker's algorithm for deadlock avoidance has ten dedicated devices (of same type) and has three processes P1, P2 and P3 with maximum resource requirements of 4, 5 and 8 respectively. There are two states of allocation of devices as follows :

State 1ProcessesP1P2P3
Devices allocated234
State 2ProcessesP1P2P3
Devices allocated024

Which of the following is correct ?

Exam Year(s)

UGC NET - 2013,

Answer: A

State 1 is unsafe and state 2 is safe, which is option (A). There are ten devices; the maximum needs are 4, 5 and 8.

State 1 allocates 2, 3 and 4, a total of 9, so 1 device is free, while the remaining needs are 2, 2 and 4. No process can be completed with one device, so the state is unsafe.

State 2 allocates 0, 2 and 4, a total of 6, so 4 are free and the remaining needs are 4, 3 and 4. P1 can finish (4 free), then P2 (3 needed, 4 free), then P3 (4 needed), so a safe sequence exists. Options (B), (C) and (D) misjudge one of the states.

Please log in or register to report this question.

16.

Usage of Preemption and Transaction Rollback prevents ______.

Exam Year(s)

UGC NET - 2013,

Answer: B

Preemption and transaction rollback are used to prevent a deadlock situation. A transaction that is waiting in a cycle is rolled back, or the resource is taken away from it by preemption, which breaks the cycle of waiting.

They do not control unauthorised use of a data file, which is the work of access control, nor data manipulation or file preemption in the sense of the options. Option B is correct. Preemption takes a resource from one process, and rollback restarts a transaction from a safe state, so neither lets processes wait for each other for ever.

Please log in or register to report this question.

17.

A system contains 10 units of resource of same type. The resource requirement and current allocation of these resources for three processes P, Q and R are as follows :

PQR
Maximum requirement875
Current allocation413

Now, consider the following resource requests :
(i) P makes a request for 2 resource units.
(ii) Q makes request for 2 resources units.
(iii) R makes a request of 2 resource units.
For a safe state, which of the following options must be satisfied ?

Exam Year(s)

UGC NET - 2013,

Answer: C

Only request (iii) leaves the system in a safe state. There are 10 units, of which 4 + 1 + 3 = 8 are allocated, so 2 are free. The remaining needs are P: 4, Q: 6, R: 2.

\[ \text{free} = 10 - (4 + 1 + 3) = 2 \]

If R gets 2 units it can finish, and returns 5 units, which gives 5 free; P then finishes with 4, which gives 8 free, and Q finishes with 6. So the state is safe. If P or Q takes the 2 free units, no units are left, and no process can be sure of finishing, so requests (i) and (ii) lead to an unsafe state.

Please log in or register to report this question.

18.

Consider a system with five processes P0 through P4 and three resource types R1, R2 and R3. Resource type R1 has 10 instances, R2 has 5 instances and R3 has 7 instances. Suppose that at time T0, the following snapshot of the system has been taken :

AllocationMax
R1 R2 R3R1 R2 R3
P00 1 07 5 3
P12 0 03 2 2
P23 0 29 0 2
P32 1 12 2 2
P40 2 24 3 3

Available : R1 = 3, R2 = 3, R3 = 2. Assume that now the process P1 requests one additional instance of type R1 and two instances of resource type R3. The state resulting after this allocation will be

Exam Year(s)

UGC NET - 2014,

Answer: B

The resulting state is a safe state. The request of P1 is (1, 0, 2). Its need is Max minus Allocation, (1, 2, 2), so the request is within its need, and it is within the available (3, 3, 2). After the grant the available is (2, 3, 0), P1 holds (3, 0, 2) and needs (0, 2, 0). The processes can then finish in the order P1, P3, P0, P2, P4 or any order that works, for example P1 needs (0, 2, 0), which is available, and returns its resources, after which the available grows to (5, 3, 2), then (7, 4, 3) after P3, and every other need is covered. As a safe sequence exists, the state is safe, not unsafe, and ready and blocked are process states, not states of allocation.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Deadlocks Questions and Answers || Deadlocks MCQ Questions and Answers || Deadlocks GK Questions and Answers || Deadlocks GK MCQ Questions || Deadlocks Multiple Choice Questions and Answers || Deadlocks GK || GK on Deadlocks || Operating Systems Questions and Answers || Operating Systems MCQ Questions and Answers || Operating Systems GK Questions and Answers || GK on Operating Systems