7,485 views
9 votes
9 votes

Consider the following process and resource requirement of each process.

Predict the state of this system, assuming that there are a total of $5$ instances of resource type $1$ and $4$ instances of resource type $2$.

  1. Can go to safe or unsafe state based on sequence
  2. Safe state
  3. Unsafe state
  4. Deadlock state

7 Answers

Best answer
23 votes
23 votes

Total no of Type 1 resources = 5

Total no. of Type 2 resources = 4

Type 1 allocated = 1+1+2=4

Type 2 allocated = 1+1+1=3

Type 1 available = Total -avl = 5-4 = 1

Type 2 available = Total - avl = 4-3=1

Now this ( 1,1)  cant handle any of one further needs of any process as the need vector (MAX - USED) for the processes are

  1. (1,2)
  2. (2,1)
  3. (2,3)


So answer is Unsafe State.

selected by
3 votes
3 votes
Type1:  Need 1 2 2

U have remain 5-(1+1+2)=1 instance

P1 take that instance and then released the resources

then P2 executes as it requires 2 more instances , then P3 executes

So, Type1 in safe state

 

Now Type 2 need 2 1 3 instances

Type2 remain 1 instances in hand

P2 takes that instance and executed

then P2 releases its resourses

P2 releases 2 instances

P1 requires 2 instances , it takes and executed

then P3 also executes

So, both are in safe state

Answer (B)
1 votes
1 votes
answer is (b) , I think in every sequence operating system has enough resources to allocate to processes.
Answer:

Related questions

6 votes
6 votes
4 answers
1
makhdoom ghaya asked May 2, 2016
3,196 views
Which of the following is not a necessary condition for deadlock?Mutual exclusionReentrancyHold and waitNo pre-emption
5 votes
5 votes
7 answers
3
8 votes
8 votes
9 answers
4