top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do you ensure that N threads can access N resources without deadlock ?

+1 vote
885 views
How do you ensure that N threads can access N resources without deadlock ?
posted Jan 13, 2015 by Shyam

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer

A very simple way to avoid deadlock while using N threads is to impose an ordering on the locks and force each thread to follow that ordering. Thus, if all threads lock and unlock the mutexes in the same order, no deadlocks can arise.

answer Jan 14, 2015 by Karthick.c
...