1,280 views
0 votes
0 votes

Consider the following process and resource requirement of each process.

    Process              Type 1              Type 2
Used Max Used Max
        P1 1 2 1 3
        P2 1 3 1 2
        P3 2 4 1 4

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.

a)Can go to safe or unsafe state based on sequence

b)Safe state

c)Unsafe state

d)Deadlock state

4 Answers

0 votes
0 votes
I feel it should be deadlock as available < need of all .so all would be waiting for each other to finish their work and release the resources which can never happen
0 votes
0 votes
For Type1 we will get need matrix as <1,2,2> i.e.,need=(max-used). for type1 again total used =1+1+2=4 .Therefore difference is  max resource-total used=1.here 1 can satisfy P1 so safe state sequence becomes

<p1,p2,p3>

Likewise for Type2 safestate sequence will be <p2,p1,p3>

I think ans is B

correct me if im wrong
0 votes
0 votes
The system is in an unsafe state. In order to be sure a process can complete, it will need its request of all resource types to be satisfied, so you need to look at the need for each process for all resource types and see if what is available can satisfy any process’s needs. In this example we have the following needs: Process Type 1 Type 2 P1 1 2 P2 2 1 P3 2 3 As we have only 1 unit of each resource type available, and no process has a need that can be satisfied, so the system is unsafe.
0 votes
0 votes
Answer is b Safe state, for type 1 initially there are 1 free resource which is allotted to P1. Which after completing we have 2 resources which complete P2, after P2 is complete we have 3 free resources which are used by P3.  

type 2  the order is P2 than P1 than P3.

Related questions

1 votes
1 votes
2 answers
1
radha gogia asked Oct 14, 2015
512 views
Just wanted to know that if none of the needs of a process is met so can we directly say that it is unsafe state as well as will lead to deadlock since none of the needs ...
5 votes
5 votes
4 answers
3
Prateek Dwivedi asked Jun 27, 2015
31,399 views
This is a question from Operating System concepts by Silberschatz, Gagne and Galvin. On very first go I could make that in such a situation deadlock can never occur. But ...