WHAT IS THREADING IN JAVA? EXPLAIN IT
THREADING :
Thread : A thread is similar to a program that has a single flow of control. It has a beginning a body, and an end execute comment sequentially, in fact all main program will have at least one thread defines separate path of execution.
Multitasking : Those who are familiar with the modern operating system windows 1995 may recognize that they can execute several programs simultaneously this ability known as multitasking. However there are two dusting type of multitasking-----
1. Process-Based.
2. Thread-Based.
1.Process-Based : A Process is a program that is executing . Thus process based multitasking is the feature that allows your computer to run two or more programs concurrently.
For example- Process-base multitasking enable to run the java compiler as the same time that you are using a text editor. In process-base multitasking, a program is the smallest unit of code that can be dispersed by the scheduler.
2.Thread-based multitasking : In a thread-based multitasking in an environment the thread is the smallest unit of disputable code. This means that a single program can perform two or more task simultaneously.
For instant a text editor can format text at the same time that it is printing, as long as these to actions are being performed by two separate thread. Thus process –based multitasking deals with the big picture and thread-based multitasking handles the details.
Multithreading : It is a specialized from of multitasking multithread programs contents two or more part that can run concurrently. Each part of such a program is thread and each thread defines a separate path of execution.
It enables to write efficient program that make maximum use of CPU ideal time can be kept to a minimum. This is especially important for the interactive, network environment in which java operates because ideal time is common.
No comments :
Post a Comment