News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

Java Threading

Started by sharmila banu.m, Jun 09, 2009, 08:01 PM

Previous topic - Next topic

sharmila banu.m

What is Multithreading? Explain how Java supports programming for multitasking environment.


A thread is one of the processes of an application. In multithreading, an OS allows different threads of an application to run in parallel.

The multitasking environment can execute in two ways.

• Process based multitasking
• Thread based multitasking

Process based multitasking –Process based multitasking is when two different processes, running at different locations, execute simultaneously. E.g.: A user can write some text using editor and simultaneously play music.

Thread based multitasking – A thread is the smallest unit of a dispatchable code.
Two different tasks like printing a document and editing it simultaneously can be done in a thread based multitasking environment.
Threads can be implemented in Java using the Thread Class.
The threading concept says that the different blocks of the same program can be executed concurrently.