Deadlock



A deadlock occurs when a thread waits forever for a resource that it will never got.
Anytime a thread tries to take more than one lock at the same time, there is a potential for a deadlock to occur. A deadlock occur when two different threads held a lock that the other one needs and then try to acquire the lock held by the other thread. The result is that each thread blocks permanently because it can never acquire the other lock.
Deadlock is a permanent blocking of a set of threads that are competing for a set of resources. The most common error causing deadlock is self deadlock or recursive deadlock: a thread tries to acquire a lock it is already holding. Recursive deadlock is very easy to program by mistake.

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart