Question by Alex: Using semaphores in Java? How can I make threads run at different frequencies to one another?
I have three different threads running in my Java program. One prints “1″, another “2″, and the last “3″. I need to make the “1″s and “2″s print less frequently than the “3″, using semaphores, but I’m very stuck. Any ideas?

Best answer:

Answer by McFate
You could wait on one semaphone between all three threads, and then:

(1) Print “3″ every time you get the semaphore in the “3″ thread
(2) Print “1″ only every second or third time you get the semaphore in the “1″ thread

Add your own answer in the comments!

Question by ?pathtotake?: How does Java make its decision when allocating time slices to Threads?
Is it completely random? For instance thread1 might start first when the app runs the first time, might might end up running last another time. How does Java make the decision?

Best answer:

Answer by Walter M
thats all up to the system

Know better? Leave your own answer in the comments!