This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
NOTE : IN THIS CODE PRIORITY IS NOT IN EFFECT, PL HELP [This message has been edited by Rahul Mahindrakar (edited February 08, 2001).]
posted 15 years ago
Because you are allowing the threads to sleep alternatively you are giving the other thread to get its work done. In the program above i have not allowed the threads to sleep. Thus the thread with a greater priority keeps working. However note that priority is not the basis on which you should schedule your work. You should not expect that a thread with a higher priority will always get the cpu and a thread with a lower priority will never get the cpu. This is because of Time Slicing.