Java supports multithreaded programming.A multithreaded program contains two or more parts that can run concurrently.Each part of such a program is called a thread, and each thread defines a separate path of execution.Thus, multithreading is a specialized form of multitasking. However, there are two distinct types of multitasking: process-based and thread-based.
Process-based multitasking is the feature that allows your computer to run two or more programs concurrently.For example, process based multitasking enables you to run the Java compiler and visit a site both at same time.
In a thread-based multitasking environment, the thread is the smallest unit of dispatchable code. This means that a single program can perform two or more tasks simultaneously.
Multitasking threads require less overhead than multitasking processes.
Processes are heavy weight tasks that require their own separate memory spaces. Interprocess communication is expensive and limited. Context switching from one process to another is also costly.
Threads, on the other hand, are lighter weight. They share the same memory space. Interthread communication is inexpensive, and context switching from one thread to the next is lower in cost.
Advantage of Multithreading:
- Better resource utilization.
- Help in Simple Program Design.
- More Responsive Programs.
- Many operations perform together so, it Save lots of time.
- Threads are independent so, it does not affect other threads if exception occur in one thread
Blog Author - Pushkar Khosla,
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.
Java I/O Tutorial


No comments:
Post a Comment