Hi,

I need to change the nice value of a process, but not sure how to do it.
My process has a priority of 0 when it is launched , i need to decrease it to some +ve value.

I know we use

os.system("renice -n value -p pidof process").

to change, but not sure whether to change the value before launching the process or after launching the process.

Any help is very much appreciated.

Thanks,

Recommended Answers

If you don't mind using a third party library, you may consider psutil where process objects have get_nice() and set_nice() methods.

Jump to Post

All 3 Replies

If you don't mind using a third party library, you may consider psutil where process objects have get_nice() and set_nice() methods.

I am not that lucky..., i cannot use that , i mean its better if we can do it by existing standard calls

I don't see how the process could have a pid before you launch it, so the answer is most certainly after launching the process. You could also start the program directly with the nice command.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.