Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Ready State

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thread States from the Java Tutorial
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Regards,
Anil
 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good post anil.
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic