What is thread in java

  • Threads consumes CPU in best possible manner, hence enables multi processing. Multi threading reduces idle time of CPU which improves performance of application.

  • Thread are light weight process.

  • A thread class belongs to java.lang package.

  • We can create multiple threads in java, even if we don’t create any Thread, one Thread at least  do exist i.e. main thread.

  • Multiple threads run parallely in java.  

  • Threads have their own stack.

  • Advantage of Thread : Suppose one thread needs 10 minutes to get certain task, 10 threads used at a time could complete that task in 1 minute, because threads can run parallely.

/** JavaMadeSoEasy.com */


Thread basics >

Thread states/ Thread life cycle in java

Difference between Process and Thread in java

Implementing Threads in java by implementing Runnable interface and extending Thread class

Threads implement their own stack - demonstration using program and diagram

Differences between implementing Runnable interface and extending Thread class

Thread behaviour is unpredictable

When threads are not lightweight process in java, in fact they become heavy weight process

Must read for you :