The condition required for dead lock in UNIX system is

Showing Answers 1 - 2 of 2 Answers

Mahesh

  • Oct 3rd, 2005
 

Condition: If the two threads lock mutexes 1 and 2 respectively, then a deadlock occurs when each attempts to lock the other mutex.

  Was this answer useful?  Yes

Mahesh

  • Oct 3rd, 2005
 

Maheswaran Wrote: Condition: If the two threads lock mutexes 1 and 2 respectively, then a deadlock occurs when each attempts to lock the other mutex.

Thread 1Thread 2
/* use resource 1 */ /* use resource 2 */
pthread_mutex_lock(&m1);pthread_mutex_lock(&m2);
  
/* NOW use resources 2 + 1 *//* NOW use resources 1 + 2 */
  
pthread_mutex_lock(&m2);pthread_mutex_lock(&m1);
  
pthread_mutex_lock(&m1);pthread_mutex_lock(&m2);

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions