Creating a Process, and changing it's priority.

D

Dave Rudolf

Hi all,

So, I am basically creating a front-end to a command-line program, and I
want the front-end to be able to control the priority at which the process
runs. There doesn't seem to be any way in the Runtime's static exec(...)
commands to specify a priority.

Any ideas?

Dave
 
L

Liz

Dave Rudolf said:
Hi all,

So, I am basically creating a front-end to a command-line program, and I
want the front-end to be able to control the priority at which the process
runs. There doesn't seem to be any way in the Runtime's static exec(...)
commands to specify a priority.

Any ideas?

Dave
On unix/linux you have to get the pid and then use "nice"
 
P

Paul Lutus

Dave said:
Hi all,

So, I am basically creating a front-end to a command-line program, and I
want the front-end to be able to control the priority at which the process
runs. There doesn't seem to be any way in the Runtime's static exec(...)
commands to specify a priority.

This is not a Java question, it is OS-specific.
 
D

Dave Rudolf

Hmm, so much for platform independance. How might one do this in Windows or
Mac land?
 
P

Paul Lutus

Dave said:
Hmm, so much for platform independance.

The point is this cannot be done in a platform-independent way, because
different platforms handle this in different ways, and some platforms don't
offer priority control at all. That is why it is not part of Java.
 
D

Dave Rudolf

Paul Lutus said:
The point is this cannot be done in a platform-independent way, because
different platforms handle this in different ways, and some platforms don't
offer priority control at all. That is why it is not part of Java.

I realize that every platform does it differently, but the same can be said
about file systems, graphics, threads, etc. That does not mean that it is
impossible to wrap in a platform independent way. I am a bit shocked that
Sun hasn't added something like this to their system. It seems like a
reasonably common thing to do.
 
L

Liz

Dave Rudolf said:
Hmm, so much for platform independance. How might one do this in Windows or
Mac land?

for windows xp you can use the "start" command with one
of the following options

/low
Starts an application in the idle priority class.
/normal
Starts an application in the normal priority class.
/high
Starts an application in the high priority class.
/realtime
Starts an application in the realtime priority class.
/abovenormal
Starts an application in the abovenormal priority class.
/belownormal
Starts an application in the belownormal priority class.
 
P

Paul Lutus

Dave said:
I realize that every platform does it differently, but the same can be
said about file systems, graphics, threads, etc. That does not mean that
it is impossible to wrap in a platform independent way.

As to setting thread priority, that is exactly what it means.
I am a bit shocked
that Sun hasn't added something like this to their system.

I am a bit shocked that you think all platforms support this feature in a
consistent way. If they did, Sun would add it to Java.
It seems like a
reasonably common thing to do.

Reasonably common isn't good enough, especially when the feature has as many
forms as there are operating systems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,268
Latest member
AshliMacin

Latest Threads

Top