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

Thread

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following methods will definetely stop a Thread from running
a) wait
b) notify
c) yeild
d) suspend
e) sleep

What will be the correct answer for above and Will certification test us on depricated methods???
Thanx
Kaushik
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think a , c, d ,e. The real test will not test on deprecated methods.
Anyone correct me if I am wrong
--Farooq
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Well IMO the correct ans are a,d & e.As yeild may stop execution but that is not guaranteed.
I can't say anything abt real exam but will tell you soon after giving mine
Regards,
Annie.
 
Kaushik Badiyani
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Muhammad are u sure of it beacuse i perfectly agree with Annie
Jane i need to know ur views on this question

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Annnie - yield will only stop thread from running if there is a thread with the same priority waiting to run - cannot yield to lower priority threads AFAIK.
HTH
Adam
 
Muhammad Farooq
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yield() will definately stop the thread from execution and look for any other thread, if there is any other thread it will execute that thread, but if there is no other thread then the original thread will get executed. Here the thread will STOP, then check for another thread, if couldn't fine, execute the same thread, thats what I think.
Any comments,
--Farooq
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From RHE

A thread that has yielded goes into the Ready state. If any other thread are in the Ready state, then the thread that just yielded might have to wait a while before it gets to execute again. However , if there are no other waiting threads, then the thread that just yielded will continue executing immediately. Note that most schedulers do not stop the yeilding thread from running in favor of a thread of lower priority.

 
Muhammad Farooq
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry, may be I misleaded you ranchers. I think I have to read the question more carefully, as the question says, "methods that will definetely stop a Thread from running", yield() does not ALWAYS stop the thread .
--Farooq
 
Ranch Hand
Posts: 2379
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yah Farooq, definitely was the word we were watching....
------------------
azaman
[This message has been edited by Ashik uzzaman (edited August 19, 2001).]
 
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic