This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes priority Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "priority" Watch "priority" New topic
Author

priority

shiva katte
Greenhorn

Joined: Feb 07, 2001
Posts: 2

NOTE :
IN THIS CODE PRIORITY IS NOT IN EFFECT, PL HELP
[This message has been edited by Rahul Mahindrakar (edited February 08, 2001).]
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1850

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.

------------------
Regds.
Mahindrakar
 
wood burning stoves
 
subject: priority