JavaRanch Home    
This page:         last edited 25 November 2007         What's Changed?         Edit

Multi Threading   

  • A thread is a lightweight process which when spawned creates parallel paths of execution
  • Analogous to multitasking. Tasks are heavyweight processes. Thread is a lightweight process which is often a part of a Task.
  • In Java there is a support for thread based multitasking. Threads in Java can be broadly classified in two types :- (1) User Thread (2) Daemon Thread. A user thread is what you get by default -- the thread that calls the main() method is a user thread. The distinction between user and daemon thread is only to determine whether a program has completed -- the JVM will exit when there are only daemon threads running. A thread can be made Daemon by calling the setDaemon(<boolean>) method. But, this call should be made before calling the start() method otherwise a IllegalThreadStateException will be thrown.

JavaRanchContact us — Copyright © 1998-2014 Paul Wheaton