• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Confusion with Thread states

 
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
source: Dan Chisholm

Which of the following thread state transitions model the lifecycle of a thread?

a. The Dead state to the Ready state
b. The Ready state to the Not-Runnable state
c. The Ready state to the Running state
d. The Running state to the Not-Runnable state
e. The Running state to the Ready state
f. The Not-Runnable state to the Ready state
g. The Not-Runnable state to the Running state

Ans: c,d,e,f
Doubt: Is option �g� not a valid one?


Thanks,
Gitesh
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I am aware there isn't a Not-Runnable state or a Ready state. Perhaps Ready means Runnable, and Not-Runnable means Blocked etc. (see below).

If I remember correctly - when you create a thread its in the New state. When you call the start() method it becomes Runnable. When the JVM selects it to run it enters the Running state. From here it can go back to Runnable, or it can go to Blocked, Sleeping, or Waiting. If it is either of the last 3 states it has to go to Runnable first before it has a chance to be Running again.
 
Ian Edwards
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I am aware there isn't a Not-Runnable state or a Ready state. Perhaps Ready means Runnable, and Not-Runnable means Blocked etc. (see below).

If I remember correctly - when you create a thread its in the New state. When you call the start() method it becomes Runnable. When the JVM selects it to run it enters the Running state. From here it can go back to Runnable, or it can go to Blocked, Sleeping, or Waiting. If it is either of the last 3 states it has to go to Runnable first before it has a chance to be Running again.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic