answersLogoWhite

0


Best Answer

A Deadlock is a situation of indefinite waiting where the system is stuck at a particular point and would do nothing useful.

For example Method A is waiting for B's input while B is waiting for C's input and C in turn is waiting for A's input. Here all the 3 methods would continue to wait because they are waiting on one another and the system is stuck.

A deadlock usually occurs while using threads. Threads can lock objects on which they are processing and when multiple threads are waiting for the same object a Dead lock may occur.

The use of the synchronize keyword can be used to avoid such deadlock situations.

User Avatar

Wiki User

βˆ™ 16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How deadlock is achieved in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How data hiding is achieved in java?

Data hiding in the java is achieved through the use of encapsulation.


How is decoupling achieved in Java programs?

Decoupling is achieved in Java programs through the parser code. To debug the decoupling achieved in Java, run the source code over the parser code first.


What are the various strategies are used to handle deadlock and what is centralized and distributed deadlock detection and prevention?

There are four strategies of dealing with deadlock problem:1. The Ostrich ApproachJust ignore the deadlock problem altogether.2. Deadlock Detection and RecoveryDetect deadlock and, when it occurs, take steps to recover.3. Deadlock AvoidanceAvoid deadlock by careful resource scheduling.4. Deadlock PreventionPrevent deadlock by resource scheduling so as to negate at least one of the four conditions.


What is abstraction method in java?

Abstraction in Java or Object oriented programming is a way to segregate implementation from interface and one of the five fundamentals along with Encapsulation, Inheritance, Polymorphism, Class and Object. Abstraction in Java is achieved by using interface and abstract class in Java.


What is an antonym for the word deadlock?

The antonym for deadlock is agreement.


When was Holy Deadlock created?

Holy Deadlock was created in 1934.


When was Deadlock - film - created?

Deadlock - film - was created in 1931.


When was Wedlock Deadlock created?

Wedlock Deadlock was created in 1947.


What are the release dates for House of Dreams - 2004 To Deadlock or Not to Deadlock 1-3?

House of Dreams - 2004 To Deadlock or Not to Deadlock 1-3 was released on: USA: 22 January 2004


How many pages does Holy Deadlock have?

Holy Deadlock has 311 pages.


What are the different method for handling deadlock?

deadlock handling by 2phase protocol


What is deadlock in java?

A deadlock is a situation that comes up when multiple threads are being used in a single java program. During thread execution, threads can access any number of methods they want. To ensure that data is consistent during execution, the methods have a property called "synchronized" which prevents multiple threads from accessing a single method. So under this scenario lets take a look at this example: Thread A is currently holding a lock on Method A and needs to execute method B in order to complete. Thread B is currently holding a lock on Method B and needs to execute method A in order to complete. The above is a classic example of deadlock.