Interviewer And Interviewee Guide

Java Multi-Threading Interview Question:

Explain deadlock?

Submitted by: Administrator
When 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

Read Online Java Multi-Threading Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.