Dimitri C.
Dimitri C.

Reputation: 22536

Is waiting for an event that will never trigger a deadlock?

A deadlock normally means that thread (or process) A is waiting for thread B, and at the same time thread B is waiting for thread A.

Currently I encountered a similar situation in our application. Thread A is waiting for an event to be set by thread B. However, thread B is not waiting for thread A, it just won't set the event (no matter for what reason). I am wondering whether this situation can also be called a "deadlock", or is there an other term for this?

Upvotes: 1

Views: 128

Answers (5)

mouviciel
mouviciel

Reputation: 67919

I would call it a starvation (ressource being CPU), not a deadlock.

Upvotes: 3

Dave Turner
Dave Turner

Reputation: 1896

Strictly speaking, no that's not deadlock, which is what you initially said (except that in general there could be a whole cycle of threads each waiting for the next one's lock: A->B->...->Z->A).

I think you could call it resource starvation, but that's quite a general term that also covers deadlock.

Upvotes: 4

Ben
Ben

Reputation: 7628

Here is my point of view :

A deadlock is a situation where the global state of the program does not progress anymore. If A is blocked but the program can still terminate because B may find a solution, it is not a deadlock.

Upvotes: 0

anon
anon

Reputation:

I'd call it a bug or bad design. But it is not deadlock if one thread is still running.

Upvotes: 5

Matthias
Matthias

Reputation: 12269

Yes - I would call this a deadlock, too.

However, only one thread (Thread A) is affected from it, not the entire application.

Upvotes: 1

Related Questions