Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in K&B SCJP 5: topic Threads

 
Paolo Dina
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 691, Waiting/Blocked/sleeping:
This is the state a thread is in when it's eligible to run
... and later...
the thread is still alive, but is currently not eligible to run.


Which one?
 
camilo lopes
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is your doubt ?
 
Paolo Dina
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on the text I quoted above, when the state of a thread is waiting, blocked or sleeping, is the thread eligible to run?
 
Ankitt Gupta
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paolo Dina wrote:Based on the text I quoted above, when the state of a thread is waiting, blocked or sleeping, is the thread eligible to run?


In the waiting state the thread is alive and after when the thread gets it's opportunity it again goes back to the runnable state.It doesn't mean that it be instantly be running.It schedule depends upon the scheduler.

The same is true for sleeping state.When the sleep time is up it again goes back to runnable state
 
Senthil Kumaran
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its a silly doubt ya, read once more the thread concepts given in K&B , if you cant understand then, post exact doubt.
 
Priyam Srivastava
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Senthil Kumaran wrote:its a silly doubt ya, read once more the thread concepts given in K&B , if you cant understand then, post exact doubt.


nothing is silly... it only lies in the eyes of the perceiver.
 
Senthil Kumaran
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i expected this sir, anyway i apologise sir,
 
Ruben Soto
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about this in simple terms. In order for a thread to be eligible to run it must be in the runnable state. If it is in any other state it is not eligible to run.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic