Deadlock

Question 1
Processes P1 and P2 have a producer-consumer relationship, communicating by the use of a set of shared buffers. Increasing the number of buffers is likely to do which of the following? I. Increase the rate at which requests are satisfied (throughput) II. Decrease the likelihood of deadlock III. Increase the ease of achieving a correct implementation
A
III Only
B
II Only
C
I Only
D
II and III Only
       Operating-Systems       Deadlock       ISRO-2018
Question 1 Explanation: 
It only satisfied statement I. because increasing the memory size increases the rate at which requests are satisfied but can not alter the possibility of deadlock and neither does it play any role in implementation.
Question 2
Consider a job scheduling problem with 4 jobs J1, J2, J3, J4 and with corresponding deadlines: ( d1, d2, d3, d4) = (4, 2, 4, 2).
Which of the following is not a feasible schedule without violating any job schedule?
A
J2, J4, J1, J3
B
J4, J1, J2, J3.
C
J4, J2, J1, J3.
D
J4, J2, J3, J1
       Operating-Systems       Deadlock       ISRO-2007
Question 2 Explanation: 
→ Feasible schedule is completing all the jobs within deadline.
→ From the dead line, we can deduce that Job J2 & J4 will complete by time “2” whereas remaining two requires time “4”.
→ So the order of completion of Jobs are Either J2 or J4 and followed by either J1 or J3.
From the given options , Option A,C & D gives the solution because after completion of Jobs J2 and J4 then only jobs J1 and J3 is going to complete.
→ But option B , order of completing jobs is J4,J1,J2 ,J3 which is not possible and it is not feasible schedule
Question 3
Consider a system having ‘m’ resources of the same type. The resources are shared by 3 processes A, B, C, which have peak time demands of 3, 4, 6 respectively. The minimum value of ‘m’ that ensures that deadlock will never occur is
A
11
B
12
C
13
D
14
       Operating-Systems       Deadlock       ISRO-2007
Question 3 Explanation: 
Minimum resources required to avoid deadlock = (m1 – 1) + (m2 – 1) +..+ (my – 1) + 1
where m = resource required by process
y = number of processes
so, Number of resources that ensures that deadlock will never occur is = (3-1) + (4-1) + (6-1) + 1 = 11
Option (A) is correct.
Question 4
Consider a system having m resources of the same type. These resources are shared by 3 processes A, B, C which have peak time demands of 3, 4, 6 respectively. The minimum value of m that ensures deadlock will never occur is
A
11
B
12
C
13
D
14
       Operating-Systems       Deadlock       ISRO-2018
Question 4 Explanation: 
A requires 3, B-4, C-6;
→ If A has 2, B has 3, C has 5 then a deadlock will occur i.e., 2+3+5=10.
→ If we have one extra resource then a deadlock will not occur i.e., 10+1=11.
→ If we have equal (or) more than 11 resources then deadlock will never occur.
Question 5
What problem is solved by Dijkstra banker’s algorithm?
A
Cache coherence
B
Mutual exclusion
C
Deadlock recovery
D
Deadlock avoidance
       Operating-Systems       Deadlock       ISRO-2017 May
Question 5 Explanation: 
Deadlock avoidance is solved by Dijkstra banker’s algorithm
Question 6
In which of the following four necessary conditions for deadlock processes claim exclusive control of the resources they require?
A
no preemption
B
mutual exclusion
C
circular wait
D
hold and wait
       Operating-Systems       Deadlock       ISRO CS 2008
Question 6 Explanation: 
Mutual Exclusion is a condition when one or more than one resource are non-sharable (Only one process can use at a time) i.e. processes claim exclusive control of the resources they require.
Question 7
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
A
15
B
9
C
10
D
11
       Operating-Systems       Deadlock       ISRO CS 2009
Question 7 Explanation: 
Number of min resources required = (3-1) + (4-1) + (6-1) + 1 = 11
Question 8
With single resource, deadlock occurs
A
If there are more than two processes competing for that resources
B
If there are only two processes competing for that resources
C
If there is a single process competing for that resources
D
None of these
       Operating-Systems       Deadlock       ISRO-2016
Question 8 Explanation: 
Only Single resource available never occur deadlock because it violates circular wait and hold & wait condition.
Question 9
A system has 3 processes sharing 4 resources. If each process needs a maximum of 2 units, then
A
Deadlock can never occur
B
Deadlock may occur
C
Deadlock has to occur
D
None of these
       Operating-Systems       Deadlock       ISRO-2016
Question 9 Explanation: 
If the system is deadlocked, it implies that each process is holding one resource and is waiting for one more. Since there are 3 processes and 4 resources, one process must be able to obtain two resources. This process requires no more resources and therefore it will return its resources when done.
Question 10
When a process is rolled back as a result of deadlock the difficulty which arises is
A
Starvation
B
System throughput
C
Low device utilization
D
Cycle stealing
       Operating-Systems       Deadlock       ISRO CS 2009
Question 10 Explanation: 

→ When a process is rolled back as a result of deadlock the difficulty which arises is starvation.
→ Resource starvation is a problem encountered in concurrent computing where a process is perpetually denied necessary resources to process its work.
→ Starvation may be caused by errors in a scheduling or mutual exclusion algorithm, but can also be caused by resource leaks, and can be intentionally caused via a denial-of-service attack such as a fork bomb
Question 11
A total of 9 units of a resource type available, and given the safe state shown below, which of the following sequence will be a safe state?
A
(P4, P1, P3, P2)
B
(P4, P2, P1, P3)
C
(P4, P2, P3, P1)
D
(P3, P1, P2, P4)
       Operating-Systems       Deadlock       ISRO CS 2011
Question 11 Explanation: 

Question 12
Which of the following is not a necessary condition for deadlock?
A
Mutual exclusion
B
Reentrancy
C
Hold and wait
D
No pre-emption
       Operating-Systems       Deadlock       ISRO CS 2013
Question 12 Explanation: 
Four Necessary and Sufficient Conditions for Deadlock are:
→Mutual exclusion
The resources involved must be unshareable; otherwise, the processes would not be prevented from using the resource when necessary.
→Hold and wait or partial allocation
The processes must hold the resources they have already been allocated while waiting for other (requested) resources. If the process had to release its resources when a new resource or resources were requested, deadlock could not occur because the process would not prevent others from using resources that it controlled.
→No pre-emption
The processes must not have resources taken away while that resource is being used. Otherwise, deadlock could not occur since the operating system could simply take enough resources from running processes to enable any process to finish.
→Resource waiting or circular wait
A circular chain of processes, with each process holding resources which are currently being requested by the next process in the chain, cannot exist. If it does, the cycle theorem (which states that "a cycle in the resource graph is necessary for deadlock to occur") indicated that deadlock would occur
Question 13
What are the minimum number of resources required to ensure that deadlock will never occur, if there are currently three processes P1, P2 and P3 running in a system whose maximum demand for the resources of the same type are 3, 4, and 5 respectively?
A
3
B
7
C
9
D
10
       Operating-Systems       Deadlock       ISRO CS 2014
Question 13 Explanation: 
let the resources needed by P1 is R1 =3,
the number of resources needed by P2 is R2 = 4 and so on.
. Minimum resources required to ensure that deadlock will never occur = (R1-1) + (R2-1) + (R3-1) + 1
= (3-1) + (4-1)+ (5-1) + 1 = 10.
Question 14
The Banker's algorithm is used:
A
to rectify deadlock
B
to prevent deadlock
C
to detect deadlock
D
to detect and solve deadlock
       Operating-Systems       Deadlock       Nielit Scientist-B IT 4-12-2016
Question 14 Explanation: 
● The Banker algorithm, sometimes referred to as the detection algorithm, is a resource allocation and deadlock avoidance algorithm ● This algorithm tests for safety by simulating the allocation of predetermined maximum possible amounts of all resources, and then makes an "s-state" check to test for possible deadlock conditions for all other pending activities, before deciding whether allocation should be allowed to continue.
Question 15

Suppose P, Q and R are co-operating processes satisfying Mutual Exclusion condition. Then if the process Q is executing in its critical section then

A
‘P’ executes in critical section
B
‘R’ executes in critical section
C
Neither ‘P’ nor ‘Q’ executes in their critical section
D
Both ‘P’ and ‘R’ executes in critical section
       Operating-Systems       Deadlock       UGC-NET DEC Paper-2
Question 15 Explanation: 
• A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource.
• This concept is used in concurrent programming with a critical section, a piece of code in which processes or threads access a shared resource.
• Only one thread owns the mutex at a time, thus a mutex with a unique name is created when a program starts.
• When a thread holds a resource, it has to lock the mutex from other threads to prevent concurrent access of the resource.
• In the question, three processes are cooperating processes and satisfying mutual exclusion condition. If process Q is executing in its critical section means remaining two processes in wait stating and they won’t enter into critical section.
Question 16
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 p and q such that Yp=Yp=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)i)where i!=p and i!=q
B
Xp+Xq>=min(Yi)where i!=p and i!=q
C
max(Xp,Xq) >1
D
min(Xp,Xq)>1
       Operating-Systems       Deadlock       Nielit Scientist-B CS 22-07-2017
Question 16 Explanation: 
Deadlock refers stops the execution of process due to non-availability of resources.
→ When two (or) more processes waiting for another process to release the resources.
→ P and Q can execute if they have sufficient resources, they don’t wait for extra resources (i.e., Xp+ Xq) required.
→ Option B can satisfies the corresponding equation i.e., Xp+ Xq >= min(Yk) where k != p and k != q.
Here we have sufficient resources.
Question 17
A system has n resources R0,..,Rn-1 and k processes P0,..Pk-1. The implementation of the resources request logic of each process Pi is a follows:
if(i%2==0)
{
if(i<n) request Ri
if(i+2 <n) request Ri+2
}
else
{
if(i<n) request Rn-i
if(i+2 < n) request Rn-i-2
}
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
       Operating-Systems       Deadlock       Nielit Scientist-B CS 22-07-2017
Question 17 Explanation: 
Consider the case where i = 10 & i = 11, n = 21 & k = 12
P10 requests R10 & R11
P11 requests R10 & R8
Hence P10 & P11 inorder in deadlock.
Question 18
A system contains three programs and each requires three tape units for its operation. The minimum number of tape units which the system must have such that deadlocks never arise is__
A
6
B
7
C
8
D
9
       Operating-Systems       Deadlock       Nielit Scientist-B CS 22-07-2017
Question 18 Explanation: 
Three programs and each requires 3 tapes.
We will allocate minimum two tapes to each program then total tapes are 6 and each program requires one more tape to complete its operation.
So, we will allocate one tape to one program and that program will complete its operation.
After completion of operation of one program, all tapes allocated to that program are free. So no need of the extra tape to complete action.
Minimum tapes required are=(3*2 tape units) + 1 tape unit = 7
Question 19
consider a system with m resources of same type being shared by n processes. Resources can be requested and release by processes only one at a time. The system is deadlock free if and only if:
A
The sum of all max needs is
B
the sum of all max needs is >m+n
C
Both of above
D
None
       Operating-Systems       Deadlock       Nielit Scientist-B CS 4-12-2016
Question 19 Explanation: 
Suppose N = Sum of all Needi,
A = Sum of all Allocation,
M = Sum of all Maxi.
Prove:
→ Assume this system is not deadlock free. If there exists a deadlock state, then A = m because there's only one kind of resource and resources can be requested and released only one at a time.
→ From condition b, N + A = M < m + n. So we get N + m < m + n. So we get N < n. It shows that at least one process i that Needi = 0. From condition a, Pi can release at least 1 resource.
→ So there are n-1 processes sharing m resources now, condition a and b still hold. Go on the argument, no process will wait permanently, so there's no deadlock.
Question 20

Banker’s algorithm is used for:

A
Deadlock avoidance
B
Deadlock recovery
C
Deadlock resolution
D
Deadlock prevention
       Operating-Systems       Deadlock       JT(IT) 2018 PART-B Computer Science
Question 20 Explanation: 
Banker’s algorithm is used for Deadlock avoidance.
Question 21
Consider a system having 'm' resources of the same type. these resources are shared by 3 processes A,B,C; which have peak time demands of 3,4,6 respectively. The minimum value of 'm' that ensures that deadlock will never occur is
A
11
B
12
C
13
D
14
       Operating-Systems       Deadlock       Nielit Scientific Assistance IT 15-10-2017
Question 21 Explanation: 
A requires 3, B-4, C-6;
→ If A have 2, B have 3, C have 5 then deadlock will occur i.e., 2+3+5=10.
→ If we have one extra resource then deadlock will not occur i.e., 10+1=11.
→ If we have equal (or) more than 11 resources then deadlock will never occur.
Question 22
An operating system contains 3 user processes each requiring 2 units of resource R. The minimum number of units of R such that no deadlock will ever occur is
A
5
B
2
C
3
D
4
       Operating-Systems       Deadlock       KVS DEC-2017
Question 22 Explanation: 
There are three processes, so there is a possibility to occur deadlock when we are taking 3 resources. If we are taking 3+1 resources means it will never occur deadlock.
Note: If there are ‘n’ processes then ‘n+1’ resources allocated, will never occur deadlock.
Question 23

If a system has multiple instances of resources, to avoid deadlock which of the following algorithms is used?

A
Deadlock avoidance algorithm
B
Aging algorithm
C
Resource allocation graph algorithm
D
Banker’s algorithm
       Operating-Systems       Deadlock       JT(IT) 2016 PART-B Computer Science
Question 23 Explanation: 
Banker's Algorithm :
Banker's algo can be applied even when Resource-system have multiple instances of each resource type. It can also be applied when Resource-system have single instance of each resource type But in that case, It would be less efficient than Resource-Allocation Graph Algorithm.
Question 24
Consider a system with seven processes A through G and six resources R through W. Resource ownership is as follows : process A holds R and wants T process B holds nothing but wants T process C holds nothing but wants S process D holds U and wants S & T process E holds T and wants V process F holds W and wants S process G holds V and wants U Is the system deadlocked ? If yes, ______ processes are deadlocked.
A
No
B
Yes, A, B, C
C
Yes, D, E, G
D
Yes, A, B, F
       Operating-Systems       Deadlock       UGC NET CS 2016 Aug- paper-2
Question 24 Explanation: 

Visual inspection shows that D, E, and G are deadlocked.
Question 25
Consider a system having ‘m’ resources of the same type. These resources are shared by three processes P​ 1​ , P​ 2​ and P​ 3​ which have peak demands of 2, 5 and 7 resources respectively. For what value of ‘m’ deadlock will not occur ?
A
70
B
14
C
13
D
7
E
None of the above
       Operating-Systems       Deadlock       UGC NET CS 2016 Aug- paper-2
Question 25 Explanation: 
A requires 3, B-4, C-7;
→ If A have 2, B have 3, C have 6 then deadlock will occur i.e., 2+3+6=11.
→ If we have one extra resource then deadlock will not occur i.e., 11+1=12.
→ If we have equal (or) more than 12 resources then deadlock will never occur.
Note: Actual answer given option-B but it satisfies option-A,B,C.
Question 26
Suppose there are four processes in execution with 12 instances of a Resource R in a system. The maximum need of each process and current allocation are given below: With reference to current allocation, is system safe ? If so, what is the safe sequence ?
A
No
B
Yes, P​ 1​ P​ 2​ P​ 3​ P​ 4
C
Yes, P​ 4​ P​ 3​ P​ 1​ P​ 2
D
Yes, P​ 2​ P​ 1​ P​ 3​ P​ 4
       Operating-Systems       Deadlock       UGC NET CS 2016 July- paper-2
Question 26 Explanation: 
Step-1: Current allocation for all processors are 3+4+2+1=10.
Step-2: Given total number of resources is 12. But we already allocated 12-10=2.
It means 2 resources are free. we can call M=2
Step-3: P4 requires 2 free resources. Total free resources are 2. So, we can allocate for P4.
Then M become M=3
Step-4: P3 requires 2 free resources. Total free resources are 2. So, we can allocate for P3.
Then M become M=5
Step-5: P1 requires 5 free resources. Total free resources are 5. So, we can allocate for P1.
Then M become M=8
Step-5: P2 requires 5 free resources. Total free resources are 8. So, we can allocate for P2.
Then M become M=12
Note: We have alternative possibility is P4,P3,P2,P1.
Question 27
A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows: The smallest value of ‘x’ for which the above system in safe state is __________.
A
1
B
3
C
2
D
Not safe for any value of x.
       Operating-Systems       Deadlock       UGC NET CS 2015 Dec- paper-2
Question 27 Explanation: 


Case 1: Let’s consider x=1
→ Now need of Process D can be fulfilled. After completing its execution Process D leaves its allocated resources.
→ Now Need of any either Process can’t be fulfilled. So the system is not in safe state with x=1.
Case 2: x=2
Available = 0 0 2 1 1
→ Need of Process D can be fulfilled and after its execution it release its allocated resources.
Available
= 0 0 2 1 1
D
= 1 1 1 1 0
---------------------------------- New available = 1 1 2 2 1
→ Now Need of Process ‘C’ can be fulfilled.
Available
= 1 1 3 2 1
C
= 1 1 0 1 0
----------------------------------
New available = 2 2 3 3 1
→ Now Need of Process ‘B’ can be fulfilled. So new available resources are
Available
= 2 2 3 3 1
C
= 2 0 1 1 0
----------------------------------
New available = 4 2 4 4 1
→ But now need of Process ‘A’ can’t be fulfilled with above available resources. So the system is not in safe state with x=2.
Case 3: x=3
Available = 0 0 3 1 1
→ Now Need of Process ‘D’ can be fulfilled and after its execution it will release its allocated resources.
Available
= 0 0 3 1 1
D
= 1 1 1 1 0
----------------------------------
New available = 1 1 4 2 1
→ Now Need of Process ‘C’ can be fulfilled
Available
= 1 1 4 2 1
C
= 1 1 0 1 0
----------------------------------
New available = 2 2 4 3 1
→ Now Need of Process ‘B’ can be fulfilled
Available
= 2 2 4 3 1
B
= 2 0 1 1 0
----------------------------------
New available = 4 2 5 4 1
→ But with available resource need of Process ‘A’ can’t be fulfilled. So the system is not in safe state with x=3.
→ Hence option (D) is the correct answer.
Question 28
Banker​ ’s algorithm is used for __________ purpose :
A
Deadlock avoidance
B
Deadlock removal
C
Deadlock prevention
D
Deadlock continuations
       Operating-Systems       Deadlock       UGC NET CS 2005 Dec-Paper-2
Question 28 Explanation: 
→ The Banker algorithm, sometimes referred to as the detection algorithm, is a resource allocation and deadlock avoidance algorithm developed by Edsger Dijkstra that tests for safety by simulating the allocation of predetermined maximum possible amounts of all resources, and then makes an "s-state" check to test for possible deadlock conditions for all other pending activities, before deciding whether allocation should be allowed to continue.
Question 29
Banker’s algorithm is for.
A
Deadlock Prevention
B
Deadlock Avoidance
C
Deadlock Detection
D
Deadlock creation
       Operating-Systems       Deadlock       UGC NET CS 2005 june-paper-2
Question 29 Explanation: 
Banker’s algorithm is for deadlock avoidance.
Question 30
A software to create a Job Queue is called ____________ .
A
Linkage editor
B
Interpreter
C
Driver
D
Spooler
       Operating-Systems       Deadlock       UGC NET CS 2006 Dec-paper-2
Question 30 Explanation: 
→ Spooling is a process in which data is temporarily held to be used and executed by a device, program or the system. Data is sent to and stored in memory or other volatile storage until the program or computer requests it for execution.
→ A software to create a Job Queue is called spooler. The spooler maintains an orderly sequence of jobs for the peripheral and feeds it data at its own rate.
Ex: Printer.
Question 31
__________ synchronize critical resources to prevent deadlock.
A
P - operator
B
V - operator
C
Semaphores
D
Hard disk
       Operating-Systems       Deadlock       UGC NET CS 2006 June-Paper-2
Question 31 Explanation: 
Semaphores synchronize critical resources to prevent deadlock.
Operations:
1. wait(P): Decrements the value of semaphore variable by 1. If the new value of the semaphore variable is negative, the process executing wait is blocked (i.e., added to the semaphore queue). Otherwise, the process continues execution, having used a unit of the resource.
wait(S)
{
while (S<=0);
S--;
}
2. signal(V): Increments the value of semaphore variable by 1. After the increment, if the pre-increment value was negative (meaning there are processes waiting for a resource), it transfers a blocked process from the semaphore's waiting queue to the ready queue.
signal(S)
{
S++;
}
Question 32
Suppose a system has 12 instances of some resources with n processes competing for that resource. Each process may require 4 instances of the resource. The maximum value of n for which the system never enters into deadlock is
A
3
B
4
C
5
D
6
       Operating-Systems       Deadlock       UGC NET CS 2018-DEC Paper-2
Question 32 Explanation: 
→ Here, every process requirement is 4 instances of the resource.
→ If we allocates 3 instance( one instance less than the requirement of each process) of the resource and to one process we allocate its minimum requirement then in that way with limited available instance of resource, without entering into deadlock we can fulfill requirement of maximum number of processes.
→ Now in question it is given that we have 12 instance then using above strategy we can allocate resources to 3 process without entering into deadlock.
Question 33
Suppose P,Q and R are co-operating processes satisfying Mutual Exclusion condition. Then if the process Q is executing in its critical section then
A
‘P’ executes in critical section
B
‘R’ executes in critical section
C
Neither ‘P’ nor ‘Q’ executes in their critical section
D
Both ‘P’ and ‘R’ executes in critical section
       Operating-Systems       Deadlock       UGC NET CS 2018-DEC Paper-2
Question 33 Explanation: 
● A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource.
● This concept is used in concurrent programming with a critical section, a piece of code in which processes or threads access a shared resource.
● Only one thread owns the mutex at a time, thus a mutex with a unique name is created when a program starts.
● When a thread holds a resource, it has to lock the mutex from other threads to prevent concurrent access of the resource
● In the question, Three process are cooperating processes and satisfying mutual exclusion condition. If process Q is executing in its critical section means remaining two processes in wait stating and they won’t enter into critical section.
Question 34
Resources are allocated to the process on non-sharable basis is
A
mutual exclusion
B
hold and wait
C
no pre-emption
D
circular wait
       Operating-Systems       Deadlock       UGC NET CS 2012 June-Paper2
Question 34 Explanation: 
Resources are allocated to the process on non-sharable basis is mutual exclusion.
Question 35
Dijkstra's banking algorithm in an operating system, solves the problem of
A
deadlock avoidance
B
deadlock recovery
C
mutual exclusion
D
context switching
       Operating-Systems       Deadlock       UGC NET CS 2011 Dec-Paper-2
Question 35 Explanation: 
Dijkstra's banking algorithm in an operating system, solves the problem of deadlock avoidance.
Question 36
A special software that is used to create a job queue is called
A
Drive
B
Spooler
C
Interpreter
D
Linkage editor
       Operating-Systems       Deadlock       UGC NET CS 2011 June-Paper-2
Question 36 Explanation: 
A special software that is used to create a job queue is called spooler.
Question 37
A Deadlock in an Operating System Is
A
Desirable process
B
Undesirable process
C
Definite waiting process
D
All of the above
       Operating-Systems       Deadlock       UGC NET CS 2010 Dec-Paper-2
Question 37 Explanation: 
Most appropriate answer is option-B but official key given as option-C. Deadlock is not definite waiting process. We can’t predict it will work after some of time.
Question 38
________ synchronizes critical resources to prevent deadlock.
A
P-operator
B
V-operator
C
Semaphore
D
Swapping
       Operating-Systems       Deadlock       UGC NET CS 2010 June-Paper-2
Question 38 Explanation: 
Semaphore synchronizes critical resources to prevent deadlock.
Question 39
A computer has 6 tape drives with ‘n’ processes competing for them. Each process may need two drives. For which values of ‘n’ is the system deadlock free ?
A
1
B
2
C
3
D
6
E
None of the above
       Operating-Systems       Deadlock       UGC NET CS 2008-june-Paper-2
Question 39 Explanation: 
→ Each process needs 2 drives. So for deadlock just give each process onedrive. So total 6 process can be given 1 drive each and can cause deadlock. So to break deadlock just reduce 1 process.
So, maximum number of process for the system to be deadlock free is 5.
Question 40
Consider a system which have ‘n’ number of processes and ‘m’ number of resource types.The time complexity of the safety algorithm, which checks whether a system is in safe state or not, is of the order of:
A
O(mn)
B
O(m2 n2 )
C
O(m2 n)
D
O(mn2 )
       Operating-Systems       Deadlock       UGC NET CS 2016 Aug- paper-3
Question 40 Explanation: 
Safety algorithm:
1) Let Work and Finish be vectors of length ‘m’ and ‘n’ respectively.
Initialize: Work = Available
Finish[i] = false; for i=1, 2, 3, 4….n
2) Find an i such that both
a) Finish[i] = false
b) Needi <= Work
if no such i exists goto step (4)
3) Work = Work + Allocation[i]
Finish[i] = true
goto step (2)
4) if Finish [i] = true for all i

→ The time complexity of the safety algorithm, which checks whether a system is in safe state or not, is of the order of O(mn2).
Where, ‘n’ number of processes and ‘m’ number of resource types.
Question 41
Consider a system with twelve magnetic tape drives and three processes P1, P2 and P3. Process P1 requires maximum ten tape drives, process P2 may need as many as four tape drives and P3may need up to nine tape drives. Suppose that at time t1, process P1 is holding five tape drives, process P2is holding two tape drives and process P3 is holding three tape drives. At time t1, system is in:
A
safe state
B
unsafe state
C
deadlocked state
D
starvation state
       Operating-Systems       Deadlock       UGC NET CS 2015 Dec - paper-3
Question 41 Explanation: 

There are 41 questions to complete.
PHP Code Snippets Powered By : XYZScripts.com