run a program with modified scheduling priority
[OPTION] [COMMAND [ARG]...]
add an example, a script, a trick and tips
nice rsync -rvh --size-only -progress $@
nice rsync --dry-run -rivh $@
Does the Linux 'nice' command work on any shell script?
Nice applies to the process that is started when running the
command and any child processes. So the answer to your question
is yes, it does work on any commands/scripts, even if they are
put into the background.
How do I elevate the priority of a process without giving that process superuser rights?
One possibility is this (which I just thought of after asking):
sudo nice -10 sudo -u user command
But it seems like there should be a more elegant method.
Remember the nice value in Linux
I don't really think you can. I have a shortcut / bash script
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.
renice 4 -p $$
and then I just run the script instead of the executable I
Why I can decrease the process's priority by using nice() function with a typical user permission(except ROOT) in linux?
(void)setpriority(PRIO_PROCESS, 0, n);
After setting the process priority to required level, delay by 1
mins so that we can check altered priority in top/ps command.
Check this link, http://linux.die.net/man/2/setpriority
can I `dtach` or `renice` graphical programs like `evince`?
dtach does not influence OS resources in the sense
that it reduces RAM or CPU cycles,
dtach detaches a
process from it's parent process.
renice on the
other hand increases / decreases the priority of the process for
the schedular; the process will gain more cpu-cycles .
So: yes, you can use
dtach to detach
evince from your
xterm (I doubt that
you open evince via
xterm anyway). This would only
ensure that closing
xterm won't close
evince. Yes, you can
renice a lower
evince and then the scheduler will call
evince less often. Memory wise there won't be any
change at all. To reduce work load you might minimize
evince so it is not visible and thus nothing
new will be rendered and no checks against
overlapping due to other programms will take place.
But, and I mean that in all seriousness: Stop fiddling around
with your system in such micromanagement style and just buy more
RAM. As long as you don't open 1000s of
evince to be
read later (which is a usage pattern I would change in the first
place) the OS will behave not really differently when you
microtune the OS. If you don't want to read the
.pdfs now: save them to disk. Problem solved.
Extra low priority processes in linux?
You could make use of cgroups for that one really low priority
process. You can create a cgroup just for that one process (call
lowprio or w/e) and use the
cpu.shares parameter to only allow it a certain
share of CPU time. You can read more about this approach in,
e.g., RHEL's Resource Management Guide.
with an adjusted niceness, which affects process scheduling.
With no COMMAND, print the current niceness. Niceness values
range from -20 (most favorable to the process)
to 19 (least favorable to the process).
add integer N to the niceness
display this help and exit
output version information and
shell may have its own version of nice, which usually
supersedes the version described here. Please refer to your
shell’s documentation for details about the options it
Copyright © 2012 Free Software Foundation, Inc. License
GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute
it. There is NO WARRANTY, to the extent permitted by law.
Report nice bugs to bug-coreutils[:at:]gnu[:dot:]org
GNU coreutils home page:
General help using GNU software:
Report nice translation bugs to
documentation for nice is maintained as a Texinfo
manual. If the info and nice programs are
properly installed at your site, the command
coreutils 'nice invocation'
should give you
access to the complete manual.