Results 1 to 5 of 5
- 09-09-2008, 10:24 AM #1Member
- Join Date
- Sep 2008
- Rep Power
how high-priority thread allow other thread
What must a high-priority thread do when it needs to perform a critical operation once every five seconds, but which still allows other threads to get CPU time?
Reduce its priority using the setPriority() method.
Use the Thread.sleep() method to relinquish control of the CPU.
Add all the other threads into its own ThreadGroup.
Use the notifyAll() method to increase priority of other threads.
Put its critical code in a Timer object.
- 09-09-2008, 01:57 PM #2
Have you written a test program to see what happens?
- 09-10-2008, 02:12 PM #3
Suggestion given by Norm is the best one.
Write a simple program with 4-5 simple threads, implement all your ways and check which would best suite.
I prefer choice2, not sure check it out.To finish sooner, take your own time....
- 09-10-2008, 03:16 PM #4
Timer object probably best, but as the other two posts suggest, only testing show true result.Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Spam ad deleted. Poster banned. Thread closed.
- By sachinj13 in forum Threads and SynchronizationReplies: 7Last Post: 09-07-2008, 09:06 PM
- By cornercuttin in forum Threads and SynchronizationReplies: 2Last Post: 04-23-2008, 10:30 PM
- By Java Tip in forum java.langReplies: 0Last Post: 04-09-2008, 06:40 PM
- By skaterxu in forum Advanced JavaReplies: 0Last Post: 01-28-2008, 08:02 AM