• 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:

Thread stopped question

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic