• 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

Marcus Mock Exam No.2 Question 24

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is option 3 not a valid answer? The only valid answer given is 1.
Under what circumstances might you use the yield method of the Thread class?
1) To call from the currently running thread to allow another thread of the same priority to run
2)To call on a waiting thread to allow it to run
3) To allow a thread of higher priority to run
4)To call from the currently running thread with a parameter designating which thread should be allowed to run
Thanks in advance
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the answer given on that page
1) To call from the currently running thread to allow another thread of the same or higher priority to run
Option 3 looks plausible but there is no guarantee that the thread that grabs the cpu time will be of a higher priority. It willdepend on the threading algorithm of the Java Virtual Machine and the underlying operating system
 
John Fairbairn
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the thread which will be allocated CPU time is dependent on
the threading algorithm of the JVM and the underlying operating system, then what is the guarantee that a thread of the SAME priority will run let alone a HIGHER priority?
Then question 1 would have to be subject to review:
(1)To call from the currently running thread to allow another thread of the same priority to run
 
reply
    Bookmark Topic Watch Topic
  • New Topic