threading and multi threading in java

9
Threading and Multi Threading By Syed Hamza Ali Shah

Upload: hamza-shah

Post on 26-May-2015

115 views

Category:

Education


4 download

TRANSCRIPT

Page 1: threading and multi threading in java

Threading and

Multi Threading

By Syed Hamza Ali Shah

Page 2: threading and multi threading in java

THREAD

A thread is a lightweight process which exists within a program and executed to perform a special task.

Page 3: threading and multi threading in java

THREAD

A process that has only one thread is referred to as a single-threaded process.

A process with multiple threads is referred to as a multi-threaded process.

Threading concept is very important in Java through which we can increase the speed of any application.

Page 4: threading and multi threading in java

THREAD

In single threaded environment, operations are executes sequentially, next operation can execute when the previous one is complete.

Page 5: threading and multi threading in java

MULTI THREADING

A multithreaded program contains two or more parts that can run.

Each part can handle different task at the same time.

Page 6: threading and multi threading in java

MULTI THREADING

Multithreading is allows a program to execute many tasks at the same time.

In the multithreading concept, several multiple tasks are run in a single process or program.

Page 7: threading and multi threading in java

example

when you use MS-WORD you perform a many different tasks such as printing, spell checking and so on, at a time.

Page 8: threading and multi threading in java

advantages

Reduces the computation time.

Improves performance of an application.

Threads share the same address space so it saves the memory.

Page 9: threading and multi threading in java

Thanx . . .