Multi-Threading in JAVA

Define Application ::

=>Set-of-programs collected together to perform defined action is known as

Application.

Define Program ::

=>set-of-Instructions is known as program.

Define Process ::

=>According to OperatingSystem,the program under execution is known as process.

=>According to Java Environment,the Application under execution is known as process.

Define Task ::

=>The part of process is known as Task.

Define MultiTasking ::

=>Executing Multiple Tasks Simultaneously is known as MultiTasking.

(Simultaneously means not parallel but at-a-time)

=>This MultiTasking is categorized into two types:

(i)Process based MultiTasking

(ii)Thread based MultiTasking

(i)Process based MultiTasking ::

=>Executing Multiple Tasks from multiple processes is known as Process based

MultiTasking.

Note:

=>This Process based MultiTasking is used in OperatingSystem design.

(ii)Thread based MultiTasking ::

=>Executing MultipleTasks from the Same process is known as Thread Based Multi

Tasking.

Note:

=>This ThreadBased MultiTasking is used in Programming Languages(Java).

=>According to JavaApplication,each ‘Servlet program’ is a Task.

Define Thread ::

=>The part of task is known as Thread.

Define MultiThreading ::

=> Multiple thread’s execution at same time is known as MultiThreading.

Summary:

=>According to JavaAppl development,

process – Appl under Execution is process

Task – Each program in application is Task

Thread – part(portion) of Task is known as Thread

Server Developer

->Tomcat Developer

Server Application Developer

=>www.gmail.com

=>www.IRCTC.co.in

*imp

Creating and Executing Threads:

=>In the process of creating Thraed,the User defined class must be implemented

from from ‘java.lang.Runnable’ interface and we use the following Steps:

step1 : The user define class must be implemented from ‘java.lang.Runnable’

interface.

Structure of Runnable Interface:

public interface java.lang.Runnable

{

public abstract void run();

}

step2 : Construct method_body for run() method part of implementation class

Note: =>The required logic is recorded part of run() method.

step3 : Create objects for implementation classes

step4 : Create object for ‘java.lang.Thread’ class and while object creation pass

reference of implementation class object as parameter.

Leave a Comment

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