The Gateway to Computer Science Excellence
+13 votes
5k views

With single resource, deadlock occurs

  1. if there are more than two processes competing for that resources
  2. if there are only two processes competing for that resources
  3. if there is a single process competing for that resources
  4. none of these
in Operating System by Boss (11.1k points) | 5k views

5 Answers

+20 votes
Best answer
is it processor or process any way assuming  it is process then surerly C can not be the ans

option B 2 process are competing for the resource one can be given and let executed so no deadlock

option A more than 2 processes competing again any one can be allocated and hence execute since there is no circular wait

ans should be D none of these
by Boss (49.3k points)
selected by
0
I think C
0
why not option A or B ??
0
It can be A or b also but c is the minimum required Condition.
0
Arjun sir please verify this que too.Because according to me even if a single process doesnt get a resource then it leads to deadlock..so obtn a,b,c all should be correct.
+4
The thing is there is only a single resource here- (single instance). So no way of forming a cyclic dependency. Also just a single process not getting a resource cannot form deadlock- it is just starvation for it - other processes are progressing..
+1
sir i have read it somewhere.
+7 votes

Answer D

Necessary conditions for deadlock are:

  • Mutual exclusion
  • Hold and wait
  • No preemption
  • Circular Wait

For deadlock to occur, one process must hold a resource which is needed by another process to complete.

For example: Consider two processes - A & B

  • A must hold some resource R1 which is needed by B.
  • B should be in need of R1, for B to complete.
  • A must need more resources for it to complete. And these more resources  should not be available i.e either down or caught by someone. This is important because, otherwise, A will complete and will release resources, which can then be used by B. 

So, A must hold and wait and B must circular wait for deadlock to occur.

Coming to question:

Since there is only one resource, no chances of circular wait, so no chance of deadlock

by Loyal (5.5k points)
+4 votes
Option D will be right option please use your intuition and find out exact answer for this question.

Single process can not be compete for itself.

If exactly two process exist then one will complete its execution then second will puts its hand for execution and all will get chance after execution and there is no circular loop exist in this problem.
by Boss (10.2k points)
0 votes

What if mutual exclusion occurs?

According to definition of  deadlock, either of the follwing condition will be there.

A deadlock situation can arise if and only if the following four conditions hold simultaneously in a system-

Mutual Exclusion: At least one resource is held in a non-sharable mode that is only one process at a time can use the resource. If another process requests that resource, the requesting process must be delayed until the resource has been released.

Hold and Wait:There must exist a process that is holding at least one resource and is waiting to acquire additional resources that are currently being held by other processes.

No Preemption: Resouces cannot be preempted; that is, a resource can only be released voluntarily by the process holding it, after the process has completed its task.

Circular Wait: There must exist a set {p0, p1,.....pn} of waiting processes such that p0 is waiting for a resource which is held by p1, p1 is waiting for a resource which is held by p2,..., pn-1 is waiting for a resource which is held by pn and pn is waiting for a resource which is held by p0.

What if any one among several processes acquires that resource and dont release it.? Definitely it will create mutual exclusion and deadlock.

So, answer  should be 'A'.

by (445 points)
0 votes

A binary semaphore could be a resource, right?

Process P1:

/*Binary semaphore A initialized to 1*/
...
P(A)
-- Do something --
P(A)
-- Do some other thing --
V(A)
...

P1 would be deadlocked because A is not a re-entrant lock.

Check this GATE 2017 question. https://gateoverflow.in/118307/gate2017-1-27

 

Option C is correct, IMO.

by Loyal (6.7k points)
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,352 answers
198,472 comments
105,244 users