Wednesday, 4 January 2017

What is meant by multithreading in java

Advanced multithreading in java

Multithreading is those type of programming concept which is used to implement the concept of multitasking. Thread means, small program which can be executed at a time. Multithreading means more then one smalls program which are executed simultaneously not concurrently using small span of time and using the round robin scheduling.

We know that JVM is an operating system over the operating system, so in JVM a scheduler is present which is responsible to implement multithreading. In multithreading threads are different states :-

(1)          New born state
(2)          Ready state
(3)          Running state
(4)          Suspended state (temporarily)
(5)          Terminated state or killed
                                                  
In JAVA a thread class is present which is used to implement the concept of multithreading. A run( ) function is present in the thread class which is used to run a thread.

An init( ) function is present, which is used to initialize a thread or new born thread is created. Start( ) function is also present, which is used to ready a thread to execute.

Stop( ) function is present which is responsible to terminate a thread. For temporarily suspended of thread three functions are present and they are-

(1)          Sleep
(2)          Suspended
(3)          Wait

The sleep( ) is automatically deactivated after specific time given in millisecond in the sleep( ) function. The suspended( ) function is deactivated when a resume( ) function is called. Wait function is deactivated when a notify( ) is called. 

This blog written by Jitendra Kumar (JAVA Trainer at Vtech Academy of Computers)- Java Certification and Java Training Courses

No comments:

Post a Comment

What is list in data structure

List: - List is a linear data structure in which elements are arranged in random order. That means list is those type of linear data struc...