adspace
Answer Posted / Varun Kandpal
Deadlocks can be avoided by following these best practices:
1. Ordering locks: Acquire locks in the same order every time.
2. Avoid circular waits: Ensure that threads cannot hold locks that would prevent each other from progressing.
3. Use the least amount of locks possible.
4. Provide a timeout when waiting for a lock to avoid waiting indefinitely.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers