615 views
0 votes
0 votes
Two processes, $A$ and $B,$ each need three records, $1, 2,$ and $3,$ in a database. If $A$ asks for them in the order $1, 2, 3,$ and $B$ asks for them in the same order, deadlock is not possible. However, if $B$ asks for them in the order $3, 2, 1,$ then deadlock is possible. With three resources, there are $3!$ or six possible combinations in which each process can request them. What fraction of all the combinations is guaranteed to be deadlock free?

1 Answer

0 votes
0 votes

Let the resources 

$(R1,R2,R3)=(1,2,3)$

Suppose A requests the resources in the order $(1,2,3)$

and B can request the resources in any order ${(1,2,3)(1,3,2)(2,1,3)(2,3,1)(3,1,2)(3,1,2)}$

When Deadlock May Occur ?

  • $A=(1,2,3) ; B=(2,1,3)$
  • $A=(1,2,3); B=(2,3,1)$
  • $A=(1,2,3) ; B=(3,1,2)$
  • $A=(1,2,3) ; B=(3,2,1)$

When there is NO possibility of Deadlock ?

  • $A=(1,2,3); B=(1,2,3)$
  • $A=(1,2,3); B=(1,3,2)$

Hence, for 6 possible combinations for $A=(1,2,3)$ , only 2 combinations are there which can never lead to Deadlock.

Source: https://gateoverflow.in/89309/consider-two-processes-p-and-q-each-need-three-records

Related questions

251
views
0 answers
0 votes
admin asked Oct 30, 2019
251 views
Local Area Networks utilize a media access method called CSMA/CD, in which stations sharing a bus can sense the medium and detect transmissions as well as ... you suggest a solution to this anomaly?Can starvation occur with this scenario?
218
views
0 answers
0 votes
admin asked Oct 30, 2019
218 views
Assume two processes are issuing a seek command to reposition the mechanism to access the disk and enable a read command. Each process is interrupted before ... or a livelock? What methods would you recommend to handle the anomaly?
519
views
1 answers
0 votes
admin asked Oct 30, 2019
519 views
Explain the differences between deadlock, livelock, and starvation.
265
views
0 answers
0 votes
admin asked Oct 30, 2019
265 views
Main memory units are preempted in swapping and virtual memory systems. The processor is preempted in time-sharing environments. Do you think that these ... handle resource deadlock or for other purposes? How high is their overhead?