Re: How to run tasks with priority?



Thanks Boudewijn,


Boudewijn Dijkstra wrote:
>> Thanks Boudewijn,
>>
>[quoted text clipped - 10 lines]
>> to verify that the difference behavior of yield method and sleep method. Do
>> you have any good ideas?
>
>Make a thread that increments a variable as fast as it can. After every
>increment it calls an abstract myWait() method that waits a number of
>milliseconds. One implementation loops yield() until it reaches the wait
>time. The other implementation simply calls sleep(long).
>

I am wondering whether your testing method will work. Since if there is
only one thread in the system, yield will have no effect. But in your
description, there are only one thread. Our testing purpose is to verify
that yield method will idle CPU (if there are more than one threads running)
, while sleep will not idle CPU.

Maybe it is my mis-understanding of your description. It is highly
appreciated if you could write down your ideas into sample source codes.


regards,
George

--
Message posted via http://www.javakb.com
.