Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Java Programming Language Interviews:Advanced JavaCore JavaEclipseFull Stack Developer (Java)HibernateIBM WebSphereInternationalization LocalizationJ2EEJ2MEJ2SEJavaJava ANTJava AppletJava BeansJava ClassesJava EJB ProgrammingJava Game DeveloperJava GUI FrameworkJava JNDIJava JNIJava JSP ProgrammingJava Message Service (JMS)Java Multi-ThreadingJava Networking - Sockets and RMIJava PatternsJava SecurityJava Server FacesJava Servlet ProgrammingJava Software EngineerJava Swing ProgrammingJava TechnicalJava ThreadsJava Transaction APIJava Web ServicesJavaMailJBossJDBCJMSJSFPortal and PortletRMISpring FrameworkSr.Java Web DeveloperStrutsSunOneSwing AWTSWT JFace
Copyright © 2018. All Rights Reserved
Java Multi-Threading Interview Question:
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
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.