Sponsored Links


Results 1 to 2 of 2

Thread: about yield and sleep in java 2011

  1. #1
    Senior Member saneha's Avatar
    Join Date
    Apr 2011
    Posts
    266

    22 about yield and sleep in java 2011

    Sponsored Links1


    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.

    Sponsored Links

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,578
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 06-23-2011, 11:41 PM
  2. Java applet working or not on windows 7 Java 2011
    By Vuhelper in forum Java forum
    Replies: 0
    Last Post: 06-14-2011, 09:22 PM
  3. Java Applet Won't Load In Browser 2011 Java
    By Vuhelper in forum Java forum
    Replies: 0
    Last Post: 06-14-2011, 09:20 PM
  4. Replies: 1
    Last Post: 04-28-2011, 08:55 PM
  5. yield of object in java
    By saneha in forum Java forum
    Replies: 1
    Last Post: 04-24-2011, 10:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft