#  >  > Programming, Development, Design, Technical Discussion >  >  > Technology and Design Forum >  >  > Programming >  >  How to Avoid Deadlock ?

## Assassin

In a multi threaded system, if a resource is blocked by one thread but is requested by another thread and vice versa, the system crashes and this causes a deadlock. This is a common and well-known problem in the multiprocessing system, parallel computing and distributed systems. This is one of the most difficult problems of multi threaded systems. Thread synchronization can be the cause of blocking situations.


The following problems may occur due to Thread Synchronization.

DeadlockStarvationPriority InversionBusy Waiting
*Let me explain How to avoid it?*

----------


## Wondergirl

> In a multi threaded system, if a resource is blocked by one thread but is requested by another thread and vice versa, the system crashes and this causes a deadlock. This is a common and well-known problem in the multiprocessing system, parallel computing and distributed systems. This is one of the most difficult problems of multi threaded systems. Thread synchronization can be the cause of blocking situations.
> 
> 
> The following problems may occur due to Thread Synchronization.
> 
> DeadlockStarvationPriority InversionBusy Waiting
> *Let me explain How to avoid it?*


Hi here ,

I have little knowledge on how to Avoid Deadlock in java,
You have figured out that the real reason for deadlock is not multiple threads And 
If you Provide an ordered ,then the problem will be resolved .

----------


## Moana

> Hi here ,
> 
> I have little knowledge on how to Avoid Deadlock in java,
> You have figured out that the real reason for deadlock is not multiple threads And 
> If you Provide an ordered ,then the problem will be resolved .


Here are some you could use



Non Overlapping LocksLock OrderingLock TimeoutSingle Thread

----------


## Assassin

> Hi here ,
> 
> I have little knowledge on how to Avoid Deadlock in java,
> You have figured out that the real reason for deadlock is not multiple threads And 
> If you Provide an ordered ,then the problem will be resolved .


Practically it won't workout in most of the times, finding the proper order is a big issue to me. Hope there will an algorithm to do that.

----------


## Assassin

> Here are some you could use
> 
> 
> 
> Non Overlapping LocksLock OrderingLock TimeoutSingle Thread


Theatrically it make sence, but what can i do in programming practically. Totally stuck on it!

----------

