Thread. A thread represents an independent module of an application that can be concurrently execution With other modules of the application. MULTITHREADING
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
A thread represents an independent module of an application that can be concurrently execution
With other modules of the application.
multithreading represents concurrent execution of multiple thread. Multiple thread is a light weight version of multiprocessing is the way that less overhead incurred by the o/s in the management to thread as compared to processes .
(it is non final method)
Syntax:public void run();
Start():- it is responsible for starting the execution of a thread.
Syntax: public void start();
STATES OF THREADS
Scheduling algo works here.
Runnable /ready to run
Swaped states over
Control is taken back from the thread by the scheduler
Processor is alloted
Thread is suspended
Defining user thread:
A user thread is represented by the run method , run method can be defined in the following two ways:
Public interface Runnable
Note: thread class provides default implementation of runnable interface .
Note: these methods are defined in object class.
Sleeping for the specified time
Block for I/O
Waiting for joined thread for complete or time out.
Waiting for lock
Wating for notification
Method or some blockesexceuted