• 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

Threads

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What wight cause the current thread to stop excutings?
A.thread of higher priority become ready. B.method sleep() be called.
C.method stop() be called D.method suspend() be called.
E.method wait() be called

c,b,d,e seem's to be the right answer's.Option A depend's on the platform.Do let me know whether the selected answer's are right or wrong.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to me a,b,c,d,e all are correct. Just now I'm done with marcuss green exam and i got almost similar question. So if thread with highest priority is ready then currect thread will stop executing
 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ashv,
I go with fraternity on this because if the scheduler is time slice then a thread with higher priority will have no effect,if the scheduler is prepmptive then it will preempt the lower priority thread.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"What wight cause the current thread to stop excutings?"
That "wight" is a very crucial misprint. The question has different answers if that should be "will" versus if it is "might" - which is it supposed to be?
Bill
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have seen similar questions all around. My questions is:
How about the thread create a intreputed exception during the execution. Will this stop the thread? I think it will, But seems nobody agree with me. Can somebody tell me why?

Thanks.

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
note that there won't be any questions on the exam
regarding deprecated methods. Thread's stop() is
deprecated.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
suspend() is also deprecated. The question was probably "might" in which case it looks as though all options are valid. As far as the Java code is concerned you cannot predict whether a higher priority thread will cause the current thread to move to the ready-to-run state. This behaviour is dependant on the thread scheduler, which in turn depends on the underlying platform. Java is platform independent and so the language itself does not enforce how the scheduler should operate.
 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,
Let me sum it up , on the discussion in this thread. This question is from marcus green's test. The correct in the test is
(A), (B) and (E). The reason as pointed out is on account of the fact that suspend() , stop() methods are deprecated in Java 2.
In the SCJP context we must be very careful on the
wording of the question. The question here cleverly asks that
What wight cause the current thread to stop excutings?
The catch is "might" and NOT "will".
I guess this will end the discussion regarding this issue.
Cheers,
Ravindra Mohan

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic