This means that a single program can perform two or more tasks simultaneously. A Text Editor can format text at the same time it is printing, as long as these two actions are performed by two separate threads. Multitasking threads require less overhead than multitasking processes. Processes are heavyweight tasks that require their own separate address spaces. Interprocess communication is expensive and limited.
Context switching from one process to another is also costly.
Threads are lightweight. They share the same address space and cooperatively share the same heavyweight process. Interthread communication is inexpensive, and context switching from one thread to next is less cost. The Java Thread Model Java uses threads to enable the entire environment to be asynchronous. This helps reduce inefficiency by preventing the waste of CPU cycles.