Multithreading

Multiprocessing

            If two or more than two program runs concurrently by using multiple processors then such concept is known as multiprocessing and each running program is known as process.

Multitasking

            If two or more than two program runs concurrently then such concept is known as multitasking and each program is known as task.

Multithreading

            When two or more than two parts of program run concurrently then such concept is known as multithreading and each part of a program is known as thread.

            Java interpreter always executes the main program in thread and each thread in java program has three basic information i.e. thread name, priority number and group name or parent name.

            Thread name is string assigned to each thread to differentiate different thread.

            Group name is the name of parent thread in which the current thread is running. Priority number is an integer number assigned by the Java interpreter, this number always varies from 1 to 10 where minimum priority number is 1 and maximum priority number is 10. Minimum number means lowest priority and maximum number means highest priority.

            When two or more than two threads enter into process state then java interpreter executes the thread as per the priority number.

currentThread()

            currentThread () is static method of thread class. It is used to find the object of currently running thread containing different information including thread name, priority number and group name.

Leave a Reply

Your email address will not be published. Required fields are marked *