Concurrency - Deadlock

> (Data|State) Management and Processing > (Concurrency|Parallel|Asynchronous) programming

1 - About

Deadlock describes a situation where two or more threads are blocked forever, waiting for each other.

At some point intensive or inappropriate exclusive locking can lead to a “deadlock” situation between two locks, where none of the locks can be released because they try to acquire resources mutually from each other.

A deadlock can occur when two or more users are waiting for data locked by each other. Deadlocks prevent some threads from continuing to work.


3 - Application

3.1 - Database

The database normally automatically detects deadlock situations and resolves them by rolling back one of the statements involved in the deadlock, thereby releasing one set of the conflicting row locks. The database should have a fail-safe mechanism which will automatically “sacrifice” one of the locks, thus releasing the resource. Processes or transactions involved in the “deadlock” get rolled back.

Deadlocks are not common. Most often they occur when transactions explicitly override the default locking of the database.

3.2 - Java

data/concurrency/deadlock.txt · Last modified: 2018/12/19 20:31 by gerardnico