aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads and JVM 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 "Threads and JVM" Watch "Threads and JVM" New topic
Author

Threads and JVM

Prasad Subramanian
Greenhorn

Joined: Aug 24, 2000
Posts: 4
HI,
I have a few doubts :
when does the JVM exit ?
a) when all the non -daemon threads are dead ?
b) when all threads incl. daemon are dead ?

What happens to the threads when the executing program terminates ?
I guess the non daemon threads terminate , but what abt non daemon ?
What does one mean by "stopping a thread "
does it imply :
stop "running " and get inyo waiting /sleeping
or "stop" altogether itself !!
Pls help !!


Prasad
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
1. when does the JVM exit ?
a) when all the non -daemon threads are dead ?
b) when all threads incl. daemon are dead ?
Choice a is right
JVM exits when there are only daemon threads running
2. What does one mean by "stopping a thread "
you are right, this expression has two meanings:
1) moving a thread from running to blocked/waiting state
2) moving it from running to dead state.
My personal approach to this questions is: if choices given include �stop� method or System.exit(0), in other words, if there are choices for �killing� a thread, then the author probably has meaning #2 in mind. Otherwise, I assume meaning #1.
I hope on real exam we will not have so badly worded questions. Actually many people said there is no ambiguity on real exam.
BTW, here is a good diagram, showing all threads movements�

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Prasad Subramanian
Greenhorn

Joined: Aug 24, 2000
Posts: 4
Thanks a lot .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads and JVM
 
Similar Threads
Do different types of Threads exist in JAVA?
what is daemon thread
Doubts in threads !
A few questions, any takers
regarding daemon thread in java