Life Cycle Iteration | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Life Cycle Iteration

In the figure which displays the life cycle of threads, you have waiting which inevitably results in death.... that's pretty dark. So, really? Waiting does not come after "runnable", but after "running"? In my mind runnable > waiting > running > death would make more sense. What's waiting good for? Example please!

20th Jul 2017, 12:48 PM
Amina Diehl
Amina Diehl - avatar
1 Answer
+ 1
runnable > running > blocked(waiting) > running > dead however , a thread can go to dead state directly from either blocked or running. the main reason for killing a blocked thread is starvation (indefinite waiting and hence indefinite locks on particular resources) ,which leads to blocking of other threads.
21st Jul 2017, 3:26 PM
Kedar Kale
Kedar Kale - avatar