How to prevent deadlock? Is there any algorithm can do this? I have two processes: one holds a semaphore and the other waits for the semaphore. When the process which holds the semaphore is dead, the deadlock occurs. My question is there is anyway (in semaphore or operating systme) to avoid such situation? Thanks!
Asked
Active
Viewed 545 times
0
-
1The question is very important and that's why there is not a simple solution. There are entire chapter books written about deadlocks. Each system has its own solution. – Juliano Feb 06 '14 at 21:18
1 Answers
0
Because threads can become blocked and because objects can have synchronized methods that prevent threads from accessing that object util waiting for another thread, it is possible for one thread to get stuck waiting for another thread, which in turn waits for another thread, etc.

user3266677
- 16
- 1