> One obvious solution is to split the program in to two parts. Where the
> main part is in one process and the heavy backend/batch part is another.
> This allows you to reduce the priority of the backend part at a
> process/OS level.
But we can not start a java program (JVM) with a different OS level
priority by using the java code, right? Unless we write a script to
call the java program with lower OS priority, as suggested from:
http://www.comptechdoc.org/os/windows/win2k/win2kprocess.html
(my code is for Win32)
One thing not sure: which method from below can get a piece of code to
run with lowest priority (for Wi32)?
1) start the java program as normal. But in the thread, using
Thread.min_priority.
2) start the java program (VM) using windows command as: start /low
"java myjava ...."
3) do the both two methods.
tom fredriksen - 21 Feb 2006 23:27 GMT
>> One obvious solution is to split the program in to two parts. Where the
>> main part is in one process and the heavy backend/batch part is another.
[quoted text clipped - 3 lines]
> But we can not start a java program (JVM) with a different OS level
> priority by using the java code, right?
I dont know about windows, but in linux a user is allowed to issue a
command one of two commands "nice LOWER_PRI CMD" or "renice LOWER_PRI PID"
Unless we write a script to
> call the java program with lower OS priority, as suggested from:
> http://www.comptechdoc.org/os/windows/win2k/win2kprocess.html
> (my code is for Win32)
But of course there is nothing wrong in dividing the program in a sort
of server/client model and allow them to communicate through TCP or some
IPC such as shared memory or pipes. And you can start it by a script.
Thats what I was thinking anyway. Of courese there is nothing wrong in
starting it from the main app, but I just find it a but awkward.
> One thing not sure: which method from below can get a piece of code to
> run with lowest priority (for Wi32)?
[quoted text clipped - 3 lines]
> "java myjava ...."
> 3) do the both two methods.
Dont know, its windows. But since windows supports threads natively, it
might not matter.
/tom
Oliver Wong - 22 Feb 2006 14:36 GMT
>> One obvious solution is to split the program in to two parts. Where the
>> main part is in one process and the heavy backend/batch part is another.
[quoted text clipped - 14 lines]
> "java myjava ...."
> 3) do the both two methods.
Only 2. If you had read the article I'd posted, perhaps you'd understand
that.
<quote>
Read http://www.javaworld.com/jw-09-1998/jw-09-threads-p2.html
especially the section titled "Get your priorities straight"
</quote>
- Oliver