Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

explain the life cycle of thread?

Answer Posted / god&

There are five states New,Runnable,Running,Blocked,Dead

New state – After the creations of Thread instance the
thread is in this state but before the start() method
invocation. At this point, the thread is considered not
alive.

Runnable (Ready-to-run) state – A thread start its life
from Runnable state. A thread first enters runnable state
after the invoking of start() method but a thread can
return to this state after either running, waiting,
sleeping or coming back from blocked state also. On this
state a thread is waiting for a turn on the processor.

Running state – A thread is in running state that means the
thread is currently executing. There are several ways to
enter in Runnable state but there is only one way to enter
in Running state: the scheduler select a thread from
runnable pool.

Dead state – A thread can be considered dead when its run()
method completes. If any thread comes on this state that
means it cannot ever run again.

Blocked - A thread can enter in this state because of
waiting the resources that are hold by another thread.

Is This Answer Correct ?    34 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you sort an array in java?

931


define polymorphism in java

1039


How to sort elements in a parallel array in java?

841


What is the difference between a method and a function in alice?

1091


What is the return type of the main method?

983


Can the interface be final?

961


What is difference between wait and notify in java?

1056


What are benefits of java?

1004


What is string in java?

960


how many types of Inheritance?

1121


How can you say java is object oriented?

1006


How do you override a private method in java?

926


I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?

930


What is the use of protected in java?

975


What will be the output of round(3.7) and ceil(3.7)?

1067