Search your topic in Java2share
Home > FAQs
eXTReMe Tracker

Multi Threading FAQs

Untitled Document

Q53.What is Starvation()? And Explain the difference between Deadlock and Starvation?
Ans. A long waiting Thread is said to be in starvation (because of least priority) but after certain time defiantly it will get the chance for execution. But in the case of Deadlock two Threads will wait for each other forever. It will never get the chance for execution.
Q54. What is race condition?
Ans.  Multiple Threads are accessing simultaneously and causing data inconsistency problem is called race condition, we can resolve this by using synchronized keyword.
Q55. What is Daemon Thread? And give an example?
Ans.  The Threads which are running in the background are called Daemon Thread.
                Example: Garbage collector.

Q56. What is the purpose of a Daemon Thread?
Ans.  The main purpose of Daemon Threads is to provide support for non-daemon Threads.