How do you avoid deadlock while coding?



How do you avoid deadlock while coding?..

Answer / 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

More Linux General Interview Questions

How to uninstall the libraries in linux?

1 Answers  


What does nslookup do?

1 Answers  


How do I check if a port is open linux?

1 Answers  


give some examples of linux open source software.

1 Answers   Motorola,


How can we define selinux?

1 Answers  


How many types of bond are there in linux?

1 Answers  


Is unix same as linux?

1 Answers  


What is the use of a symbolic link in linux?

1 Answers  


What is zombie process in linux?

1 Answers  


Is linux is virus free?

1 Answers  


Why we use red hat linux?

1 Answers  


What is export ld_library_path?

1 Answers  


Categories