Java thread deadlock: why can't Java recover from the deadlock like a database?

can JVM handle deadlocks in the same way as database transactions? If not, then what is the reason?

throw a brick to attract jade:

the phenomenon of sequential deadlock is described in Java concurrent programming practice, and the philosopher dining problem is mentioned. When a sequential deadlock occurs, a database transaction chooses a victim to release resources and can be reexecuted, and the transaction can be completed normally.
as a result, can JVM find a victim to release resources when a deadlock occurs? Would multithreaded programming be much easier if deadlock avoidance could be accomplished at the JVM level?

again, the question is, can JVM handle deadlocks in the same way as database transactions? If not, then what is the reason?

Mar.22,2021

https://www.quora.com/How-doe.


deadlock avoidance is at most an exception thrown by the lock () method when it will cause a deadlock. Does this make multithreaded programming more complicated? Imagine a situation where every lock () method has the possibility of exception. So PLSQL is also very difficult to write, PLSQL is to encounter this kind of deadlock caused by exception, and always have to find a way to deal with it.

Menu