free geoip

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
about yield and sleep in java 2011
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
dear sir in case of yield it give chance to the next thread of equal priority but if we use the sleep and our program have the two or more equal priority threads then is sleep give chance to the next equal priority thread or it give chance to the next thread which has higher priority but lower priority then the currenlty running thread? please explian it.
Reply
#2
yield() method pauses the currently executing thread temporarily for giving a chance to the remaining waiting threads of the same priority to execute. If there is no waiting thread or all the waiting threads have a lower priority then the same thread will continue its execution. The yielded thread when it will get the chance for execution is decided by the thread scheduler whose behavior is vendor dependent.





But in case of sleep() it is not compulsory that next thread should have higher priority but lower priority then the thread which have been sent to sleep. In case of sleep next thread in the queue will run which ever has higher priority in the queue.

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Learning Java From Scratch: A Practical Beginner's Guide admin 0 11 Yesterday, 05:03 PM
Last Post: admin
  How to run a java file that creaded in Ntebeans in console Vuhelper 1 5,027 08-01-2012, 10:23 PM
Last Post: Pari ch
  Send image to client over a socket in java 2011 Vuhelper 1 3,732 04-21-2012, 02:11 AM
Last Post: hoailenpro
  double buffering in java 2011-12 Vuhelper 0 2,249 09-12-2011, 10:30 PM
Last Post: Vuhelper
  Using wait and notify? in java 2011-12 Vuhelper 0 2,175 09-12-2011, 10:29 PM
Last Post: Vuhelper
  text wrap in java 2011-12 Vuhelper 0 2,185 09-12-2011, 10:27 PM
Last Post: Vuhelper
  How find the data in ArrayList? 2011-12 Vuhelper 0 2,543 09-04-2011, 07:21 AM
Last Post: Vuhelper
  TableModelListener ERROR in Java 2011 Vuhelper 0 2,074 07-23-2011, 05:47 PM
Last Post: Vuhelper
  Exception Handling in Java 2011 Vuhelper 0 2,025 07-23-2011, 05:46 PM
Last Post: Vuhelper
  Getting the element of a vector in Java 2011 Vuhelper 0 1,925 07-23-2011, 05:45 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support