File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Ready State Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Ready State" Watch "Ready State" New topic

Ready State

V Bose
Ranch Hand

Joined: Jul 10, 2003
Posts: 113
In the context of threads, whats the difference between a New,Runnable and Ready state. Dan Chisolms questions mention the Ready state...
[ May 18, 2004: Message edited by: V Bose ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Thread States from the Java Tutorial

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Anil Hulikal

Joined: Apr 02, 2004
Posts: 29
Khalid Mughal and Rolf Rasmussen's book has this explanation in section 9.5. (It would be much easier to follow with the state diagram they have given in the book).

Ready-to-run state
A thread starts life in the Ready-to-run state (see p. 369).
Running state
If a thread is in the Running state, it means that the thread is currently executing (see p. 369).
Dead state
Once in this state, the thread cannot ever run again (see p. 380).
Non-runnable states
A running thread can transit to one of the non-runnable states, depending on the circumstances. A thread remains in a non-runnable state until a special transition occurs. A thread does not go directly to the Running state from a non-runnable state, but transits first to the Ready-to-run state.
The non-runnable states can be characterized as follows:
1. Sleeping: The thread sleeps for a specified amount of time (see p. 370).
2. Blocked for I/O: The thread waits for a blocking operation to complete (see p. 380).
3. Blocked for join completion: The thread awaits completion of another thread (see p. 377).
4. Waiting for notification: The thread awaits notification from another thread (see p. 370).
5. Blocked for lock acquisition: The thread waits to acquire the lock of an object (see p. 359)

Basically, once a thread (of execution) is started with start(), it won't start "running" immediately, instead it enters into "ready to run state" to be picked up by the scheduler.


Just stay focused.
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
Good post anil.

SCJP, blog
I agree. Here's the link:
subject: Ready State
It's not a secret anymore!