Search your topic in Java2share
Home > FAQs
eXTReMe Tracker

Multi Threading FAQs

Untitled Document

Q61. After starting a thread is it possible to change Daemon nature?
Ans.  We can change the Daemon nature before starting the Thread only. Once Thread started we are not allow to change Daemon nature otherwise we will get RuntimeException sying IllegalThreadStateException.
Q62. When the Daemon thread will be terminated?
Ans.  Once last non-daemon Thread terminates automatically every Daemon Thread will be terminated.
Q63. What is green Thread?
Ans.   A green thread refers to a mode of operation for the Java Virtual Machine (JVM) in which all code is executed in a single operating system thread. If the Java program has any concurrent threads, the JVM manages multi-threading internally rather than using other operating system threads.
There is a significant processing overhead for the JVM to keep track of thread states and swap between them, so green thread mode has been deprecated and removed from more recent Java implementations.

Q64.Explain about Thread group?
Ans. Every Java thread is a member of a thread group. Thread groups provide a mechanism for collecting multiple threads into a single object and manipulating those threads all at once, rather than individually. For example, you can start or suspend all the threads within a group with a single method call. Java thread groups are implemented by the ThreadGroup api class in the java.lang package.