Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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
 
it's a teeny, tiny, wafer thin ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic