• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

thread execution!

 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q.22 What can cause a thread to stop executing?(From Marcus mock2)
1) The program exits via a call to System.exit(0);
2) Another thread is given a higher priority
3) A call to the thread's stop method.
4) A call to the halt method of the Thread class?
how can the option 2) be right? The question states to stop the execution not to stop the thread temporarily.
ashok.
 
Ranch Hand
Posts: 171
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(1) is definitely right.
(2) I guess it depends on your definition of "stop executing" which is ambiguous IMHO. It oculd mean to temporarily take away CPU cycles from the thread, or to logically stop the thread. The designers of the Sun Java exam have worked hard to eliminate any linguistic ambiguity; so, as long as you understand the concepts of threading, you should not be troubled by mock questions such as this.
(3) The "stop" method is deprecated, so there will not be any questions about it on the exam.
(4) is wrong, because there is no "halt" method.
Geoffrey

------------------
Sun Certified Programmer for the Java 2 Platform
 
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(1) is perfect
(2) I cant accept that
What if the OS thread scheduling is RoundRobin?(For ex: Windoze)
-Ragu
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question is
Q.22 What can cause a thread to stop executing?
not
Q.22 What will cause a thread to stop executing?
If a another thread has a higher priority, in certain systems it may cause the current thread to stop. The stop may be temporary or permanent (if System.exit is called for example).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic