Explain deadlock?
Submitted by: AdministratorWhen two or more threads are waiting for each other and get blocked forever then this situation is called Deadlock.
During deadlock two threads, each thread has acquired a lock on one resource and trying to acquire a lock on resource of other thread.
Each thread will wait indefinitely for the other to release the lock, unless one of the user processes is stopped.
In terms of Java API, thread deadlock situation can arise in following conditions:
1. When two threads call Thread.join() on each other.
2. When two threads use nested synchronized blocks to lock two objects and the blocks lock the same objects in different order.
Submitted by: Administrator
During deadlock two threads, each thread has acquired a lock on one resource and trying to acquire a lock on resource of other thread.
Each thread will wait indefinitely for the other to release the lock, unless one of the user processes is stopped.
In terms of Java API, thread deadlock situation can arise in following conditions:
1. When two threads call Thread.join() on each other.
2. When two threads use nested synchronized blocks to lock two objects and the blocks lock the same objects in different order.
Submitted by: Administrator
Read Online Java Multi-Threading Job Interview Questions And Answers
Top Java Multi-Threading Questions
☺ | Explain deadlock? |
☺ | What is the sleep() method Data type for the parameter? |
☺ | Explain the difference between preemptive scheduling and time slicing? |
☺ | How many threads at a time can access a monitor? |
☺ | Name the default thread at the time of starting the program? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |