This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread stopped question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread stopped question" Watch "Thread stopped question" New topic
Author

Thread stopped question

Don Wood
Ranch Hand

Joined: Dec 05, 2003
Posts: 65
From the John Hunt exam:

Which methods may cause a thread to stop executing?
A. sleep();
B. stop();
C. yield();
D. wait();
E. notify();
F. notifyAll()
G. synchronized()

Answers given are A, B, C, D.
I understand that we don't have to worry about deprecated methods so B. won't be an answer that we would need to select.
My questions are:
On the exam, what is meant when they say a thread stops executing?
1. The thread is in Ready state just waiting for CPU time.
2. The thread is asleep (it is in a wait(), join(), sleep() or waiting for a lock).
3. The thread has terminated.
4. All of the above.
Does 1. really count as the thread being stopped?
Is waiting the same as stopped?
[ February 01, 2004: Message edited by: Don Wood ]
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
Hi Don,
I would guess the exam must be consistent with The Java Programming Language by Arnold, Gosling and Holmes. So whenever the various certification guides and mock exams disagree on terminology (or facts), I reach for TJPL.
And for threads, TJPL must be consistent with Doug Lea. You can't go wrong with Lea. (His concurrent utilities will be a part of the Tiger Release of Java 1.5) So I also check Concurrent Programming in Java.
In CCP 1.3.2 Liveness, Lea lists reasons a thread may fail to make progress. One reason is "CPU contention. A thread fails to run even though it is in a runnable state because other threads, or even completely separate programs running on the same computer, are occupying CPU or other computational resources."
To me, that sounds like the thread is stopped. The VM is not executing the thread, the thread is not running, so it must be stopped. (If it were not stopped, then it is going. But this thread is not going anywhere.)
TJPL and CCJ use the words blocked, paused, suspended and terminated. The 3 Sun e-Practice exams use the words blocked and terminated. I didn't see any use of stopped.
On the exam I took, the way questions were asked was very reasonable. I wouldn't worry about ambiguous questions.
[ February 02, 2004: Message edited by: Marlene Miller ]
Don Wood
Ranch Hand

Joined: Dec 05, 2003
Posts: 65
I've never come across anyone describing a thread that is in ready state as a stopped thread before I started looking at Java. I just needed Java's view of what a stopped thread means.
Thanks for your reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread stopped question
 
Similar Threads
Threads Execution
What to do if a question include Deprecated Methods in Exams
thread's
Q on thread at Jxam
JTest and threads