K
Kevin
(I googled but did not find any answer)
In my program, there is a long time running thread that doing a lot of
IO and computation in background. I want to put this thread running
only when the PC's CPU is free (and hopefully the memory is "free"
too).
It seems that start that thread with Thread.MIN_PRIORITY is not what I
want. It forces the thread to give up CPU time if other programs
require the CPU, but the thread is running all the time AND we can
easily feel it. I am looking for a way to "sleep" the thread when other
programs are using the CPU.
Of course, CPU is in use by a lot of programs all the time.
The point is: using Thread.MIN_PRIORITY, we can still obviously feel
the coding is running there (especially if it involes a lot on IO,
compuation and memory). Some programs like google's desktop search,
user does not feel it is indexing the files (a lot of IO and
computation, I guess) beacuse it does so when the PC is "free". How to
catch that "free" in Java?
Hope I get my question clear.
Nice day!~
In my program, there is a long time running thread that doing a lot of
IO and computation in background. I want to put this thread running
only when the PC's CPU is free (and hopefully the memory is "free"
too).
It seems that start that thread with Thread.MIN_PRIORITY is not what I
want. It forces the thread to give up CPU time if other programs
require the CPU, but the thread is running all the time AND we can
easily feel it. I am looking for a way to "sleep" the thread when other
programs are using the CPU.
Of course, CPU is in use by a lot of programs all the time.
The point is: using Thread.MIN_PRIORITY, we can still obviously feel
the coding is running there (especially if it involes a lot on IO,
compuation and memory). Some programs like google's desktop search,
user does not feel it is indexing the files (a lot of IO and
computation, I guess) beacuse it does so when the PC is "free". How to
catch that "free" in Java?
Hope I get my question clear.
Nice day!~