recategorized by
464 views
1 votes
1 votes

Consider there are $3$ threads T1, T2, and T3. And there are $4$ locks L1, L2, L3, and L4.

  1. T1 acquires and releases the locks L1 and L2.
  2. T2 acquires and releases the locks L1 and L3.
  3. T3 acquires and releases the locks L3, L1, and L4.

In which of the following cases deadlock is possible?

  1. T1 runs to completion, then T2 to completion, then T3 runs.
  2. T1 and T2 runs concurrently to completion and then T3 runs.
  3. T1 and T3 runs concurrently to completion and then T2 runs.
  4. None of the above.
recategorized by

1 Answer

0 votes
0 votes
From the above, only T2 and T3 can deadlock, because they each grab two locks (L1 and L3) in some order.
Answer:

Related questions

1 votes
1 votes
1 answer
4