Introduction to Multithreading

Types of Multitasking

1.Processed based multitasking (Used by OS )
2.Thread based multitasking (Used by Programming Languages like Java)

What is Thread ?

  • A flow of execution is a Thread.
  • For every thread a separate individual job is present.

Use of multi threading in real world application

-To develop web server and application servers, were clients connect to application via web sever for each client a thread is created.

Where to use multi-threading concept?
-Where individual operations can be performed independently.

When compare with old languages implementing multithreading is much easier in java since java has rich multithreading API(Thread, Runnable,Group…..) and programmer is only required to perform 10% of the task is required by the programmer to perform 90% of the task is done by Java itself.

Thread Class constructors :

  1. Thread()
  2. Thread(String name)
  3. Thread(Runnable target)
  4. Thread(Runnable target, String name)
  5. Thread(ThreadGroup group, String name)
  6. Thread(ThreadGroup group, Runnable target)
  7. Thread(ThreadGroup group, Runnable target, String name)
  8. Thread(ThreadGroup group, Runnable target, String name, long stackSize)

Leave a Comment