views:

42

answers:

2

I have a Java program running on a linux system, which I would like to give a higher IO Scheduler priority. Is there a library JNI/JNA based that would allow me to do that from within my code?

A: 

You could spawn and external command and call ionice on your process.

Romain Hippeau
That's close to what I am probably going to do - capture pid at start up and call ionice from the same script I use to launch the app.
Michael Barker
A: 

You can get the PID of the Java Process by using the Java Management API, at least when using the Sun JVM. Have a look at the actual implementations of the management objects, one returns the pid (don't know which for the moment).

Then I would use jnative to call the linux function, so you don't have to rely on ionice to be installed.

Daniel