Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On Linux, how to make the processes remember their nice between starts ?

For XP+ you can use Prio to remember the priority and also the IO priority on VISTA+. However, on Linux, and only for running via terminal, I've had to create a command in /etc/bash.bashrc. Changing a shortcut works too, but you can't create endless count of them.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I don't really think you can. I have a shortcut / bash script that renice's itself and then launches the executable associated with it. I generally don't have too many processes that I have to renice (just my minecraft server), so I haven't found it to be too big of an issue.

#!/bin/sh
renice 4 -p $$
mono McMyAdmin.exe

and then I just run the script instead of the executable I usually would.

share|improve this answer
    
Accepted as an answer, for the script. Someone really should make something like Prio. Can't be that hard for a Linux coder. –  rautamiekka Jan 13 '12 at 18:20

For the few commands you may run frequently that you want niced, you can alias the command in your .bashrc file. This can be overridden if you want to run without nice.

In years of working with Unix and Linux, I haven't needed to run many programs using nice. Most of those I don't want niced all the time. The scheduling model on Unix works well in most cases without it.

Most of the programs that I do want niced all the time have a mechanism already. I run BOINC to share spare CPU cycles with various research projects. It is automatically niced, and has options to stop working when there is a heavy load.

There are some batch jobs I want niced. They tend to be scripted, so it is easy to add the nice command to the beginning of the command line.

If I do fire up a lot of processes at once, I may renice some processes. Now that ionice is available, I have had occasion to use it on a running process, but it is not something I routinely do.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.