Level 181 Level 183
19 words 0 ignored
Ready to learn Ready to review
Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.
a multi threaded programming language
we can develop multi threaded program using Java
A multi threaded program
contains two or more parts that can run concurrently and each part can handle different task at the same time making optimal use of the available resources specially when your computer has multiple CPUs.
A new thread begins its life cycle in the new state. It remains in this state until the program starts the thread. It is also referred to as a born thread.
After a newly born thread is started, the thread becomes runnable. A thread in this state is considered to be executing its task.
Sometimes, a thread transitions to the waiting state while the thread waits for another thread to perform a task.
A runnable thread can enter the timed waiting state for a specified interval of time.
A runnable thread enters the terminated state when it completes its task or otherwise terminates.
public void start()
Starts the thread in a separate path of execution, then invokes the run() method on this Thread object.
public void run()
If this Thread object was instantiated using a separate Runnable target, the run() method is invoked on that Runnable
public final void setName(String name)
Changes the name of the Thread object. There is also a getName() method for retrieving the name.
public final void setDaemon(boolean on)
A parameter of true denotes this Thread as a daemon thread.
public final void join(long millisec)
the current thread invokes this method on a second thread, causing the current thread to block until the second thread terminates or the specified number of milliseconds passes.
public void interrupt()
Interrupts this thread, causing it to continue execution if it was blocked for any reason.
public final boolean isAlive()
Returns true if the thread is alive, which is any time after the thread has been started but before it runs to completion.
public static void yield()
Causes the currently running thread to yield to any other threads of the same priority that are waiting to be scheduled.
public static void sleep(long millisec)
Causes the currently running thread to block for at least the specified number of milliseconds.
public static boolean holdsLock(Object x)
Returns true if the current thread holds the lock on the given Object.
public static Thread currentThread()
Returns a reference to the currently running thread, which is the thread that invokes this method.
public static void dumpStack()
Prints the stack trace for the currently running thread, which is useful when debugging a multithreaded application.