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 :
- Thread(String name)
- Thread(Runnable target)
- Thread(Runnable target, String name)
- Thread(ThreadGroup group, String name)
- Thread(ThreadGroup group, Runnable target)
- Thread(ThreadGroup group, Runnable target, String name)
- Thread(ThreadGroup group, Runnable target, String name, long stackSize)