aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes thread question of Dan Chisholm mock exam 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 "thread question of Dan Chisholm mock exam" Watch "thread question of Dan Chisholm mock exam" New topic
Author

thread question of Dan Chisholm mock exam

Serena Zhou
Ranch Hand

Joined: Dec 13, 2003
Posts: 31
The following Dan Chisholm question has the answer of a, but why c is not correct? Because join method will force the current executing thread to Ready status as long as the thread that call join is alive. So the join method in Thread will not force a thread to move into the Not-Runnable state. Correct me if I am wrong and thanks!
pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182
The following Dan Chisholm question has the answer of a, but why c is not correct? Because join method will force the current executing thread to Ready status as long as the thread that call join is alive. So the join method in Thread will not force a thread to move into the Not-Runnable state. Correct me if I am wrong and thanks!
Runnable : once a thread's start() method is called, it is said to be in runnable state. The Runnable state can be thought of as a default state. if a thread is not in any other state, it's in the runnable state
yield : The yield method causes the runtime to context switch from the current thread to the next available runnable thread. This is one way to ensure that threads at lower priority do not get starved.
join : Let an object wait for a thread to complete at a later time Or, Thread.join(long msec) can be used to obtain calls with time-out
"So the join method in Thread will not force a thread to move into the Not-Runnable state. " ..........is proved correct
"join method will force the current executing thread to Ready status as long as the thread that call join is alive."......correct i think
but this leaves me with a confusion Ready state and Runnable state the same?


Thanks,<br />Pallavi
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
but this leaves me with a confusion Ready state and Runnable state the same?

Yes. I have the use of "Ready" and "Runnable" but not at the same time. So I think you can assume they are both names for the same state.
Looking ahead to Java 1.5 there is a new Thread State Enum.
In the case of Thread.join(), the calling thread would not have to leave the running state if the joined to-thread had already finished, it can keep on running. Probably this is an implementation dependent thing.
[ April 18, 2004: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: thread question of Dan Chisholm mock exam