user3763116
user3763116

Reputation: 235

What are the types of deadlocks?

as per title, what are the types of deadlocks? Recently I was asked this question, but I was aware of only on type of deadlock, when thread A is waiting for a lock which is acquired by thread B, whereas thread B is waiting for a lock which is acquired by thread A. Are there any other?

Upvotes: 2

Views: 42129

Answers (1)

Dhaval Simaria
Dhaval Simaria

Reputation: 1964

Two types of deadlocks can be considered:

1. Resource Deadlock

Occurs when processes are trying to get exclusive access to devices, files, locks, servers, or other resources.

In Resource deadlock model, a process waits until it has received all the resources that it has requested.

The resource model is also called the AND model. In this model, a deadlock occurs if and only if there is a cycle of waiting processes, each dependent on the next process in the cycle to make progress.

Possible situation: Transaction-processing scenario

2. Communication Deadlock

Also referred to as Communication deadlock model, occurs when process A is trying to send a message to process B, which is trying to send a message to process C which is trying to send a message to A.

The communication deadlock model is also called OR model.

Evidently, it easily satisfies the Circular-wait condition for deadlock to occur.

Possible situation: Message-passing scenario

Hope this will work for you and satisfy the questioner.

Upvotes: 8

Related Questions