File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Marcus Mock Exam No.2 Question 24

 
John Fairbairn
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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 is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic