In order to prevent deadlocks one (or more) of the requirements for a deadlock has to be eliminated:
- Mutual exclusion: In some situation it is possible to prevent mutual exclusion by using optimistic locking.
- Resource holding: A thread may release all its exclusive locks, when it does not succeed in obtaining all exclusive locks.
- No preemption: Using a timeout for an exclusive lock frees the lock after a given amount of time.
- Circular wait: When all exclusive locks are obtained by all threads in the same sequence, no circular wait occurs.
No comments:
Post a Comment