Tag Info

Hot answers tagged

15

It's for what I'd call policy reasons. The idea is that normal users can't override the actions of privileged users. Let's say you're a user on some enormous shared server. You're running monstrous CPU-hogging processes to the detriment of the other users. The sysadmin renices some of your processes because he doesn't like you very much. The OS doesn't ...


14

Since linux 2.6.12, that depends on the value of the RLIMIT_NICE limit (ulimit -e). Which can take values from 0 to 40. That limit is more the limit on the priority of the process (the greater that number, the higher the priority a user can set for a process). You'll notice the default value is 20 on ubuntu 10.04 and 0 in Debian jessie for instance. A ...


11

What does a niceness of (-) indicate? Notice those also have a PRI score of -100; this indicates the process is scheduled as a realtime process. Realtime processes do not use nice scores and always have a higher priority than normal ones, but still differ with respect to one another. You can view details per process with the chrt command (e.g. chrt -p ...


11

Yes. However, if the nice value of the parent process changes after forking the child processes, the child processes do not inherit the new nice value. You can easily observe this with the monitoring tool top. If the nice field (NI) is not shown by default, you can add it by pressing f and choosing I. This will add the NI column to the top display. * I: NI ...


10

Disk and memory scheduling are entirely different. In the absence of an IO priority scheduler, IO will be handled on a first come first served basis. If the system is IO bound, then all processes run in a more or less round robin basis until all are waiting for I/O. The nice priority of a process will have little impact on its scheduling frequency. ...


8

I would start it normally and use "renice" afterwards... However I was able to make a quick hack together with "su" which works: sudo nice -n -20 su -c command_to_run user_to_run_as (If you don't have to give sudo a password - perhaps because you've already just given it - you may add an "&" to put the whole thing in the background.) Since you ...


8

nice -n 15 sh -c "command1 | command2 | command3" This sets niceness of a subshell, and the commands 1..3 inherit it. Edit: Sorry, the parenthesis will not do. There has to be a seperate shell invocation.


7

The pam_limits.so module can help you there. It allows you to set certain limits on specific individual users and groups or wildcards or ranges of users and groups. The limits you can set are typically ulimit settings but also on the number of concurrent login sessions, processes, CPU time, default priority and maximum priority (renice). Check the ...


6

nice -n 15 command1 | nice -n <num> command2 | nice -n <num> command3 nice isn't used differently from any other command.


5

It will not reduce your load. It will only let other processes use CPU time more often if there is a possible resource contention (several processes "competing" for not enough available CPU time).


5

The proportion of the processor time a particular process receives is determined by the relative difference in niceness between it and other runnable processes. The Linux Completely Fair Scheduler (CFS) calculates a weight based on the niceness. The weight is roughly equivalent to 1024 / (1.25 ^ nice_value). As the nice value decreases the weight increases ...


5

There is big difference between them. ulimit -e only set the RLIMIT_NICE, which is a upper bound value to which the process's nice value can be set using setpriority or nice. renice alters the priority of running process. Doing strace: $ cat test.sh #!/bin/bash ulimit -e 19 Then: $ strace ./test.sh ................................................... ...


4

I believe the correct format is: @users - priority 10 username - priority 19 This is an example of the settings I am using in production (obviously with real users/groups). The nice setting is to determine the maximum nice value someone can set their process to, not their default priority.


4

You can write up your own script that uses ps to list all processes in the run/runnable state without a nice value greater than 0. The specific syntax you need to use will differ based on your version of ps. Something like this may work: ps -eo state,nice | awk 'BEGIN {c=0} $2<=0 && $1 ~ /R/ { c++ } END {print c-2}' It runs ps collecting the ...


4

Surely there must be a better way than this, but on most Linux-based systems: ps -o pid -C pidgin --no-headers --deselect will give you all pids on the system, apart from those for the command pidgin, so renice -n 5 $(ps -o pid -C pidgin --no-headers --deselect) will try to renice everything butpidgin, but fail for processes you don't own


4

@Goldlilock's answer directed me to do the research in the right path. This is my research details. Scheduling Algorithms available for processes Linux supports 3 scheduling policies. SCHED_FIFO, SCHED_RR, and SCHED_OTHER. SCHED_OTHER is the default universal time-sharing scheduler policy used by most processes; SCHED_FIFO and SCHED_RR are intended for ...


3

Changing the nice value will not directly reduce system load. It can however be used to leave more resources available to the remaining processes, which I suspect is what you really want. From http://linux.101hacks.com/monitoring-performance/hack-100-nice-command-examples/ Kernel decides how much processor time is required for a process based on the ...


3

You can set the priority for a particular user in /etc/security/limits.conf file. root hard/soft priority 10 This way u can set hard or soft limit for any particular user. So all the processes which this root user will start will have 5 as the default priority vale. According to Wikipedia page: The exact mathematical effect of setting a ...


3

Just use nice (instead of renice). For example: nice -n 10 command This will run command with a low priority.


3

Have a look at cgroups, it should provide exactly what you need - CPU reservations (and more). I'd suggest reading controlling priority of applications using cgroups. That said, put the important yet often idle processes into group with allocated 95% of CPU and your other applications into another one with allocated 5% - you'll get (almost) all of the power ...


3

Have you taken a look at ionice? You may want to run updatedb/find with posix fadvise to inform the OS that you don't want these programs to dirty your page cache. That way, your cached disk i/o stays in memory. You can also rework your cron jobs to have these background processes pushed to times when your computations are not running. Additionally, you ...


2

I wrote a small script in perl to do what you ask: http://pastie.org/3460943 It works by getting all the current X11 window IDs using the "xlsclients -l" command, in turn getting the window's PID with xprop. It then uses xprop -root to get the currently focused window, then loops through all the PIDs to change their nice value to 5 (keeping the currently ...


2

These snippet of Debian's /etc/default/rsync (Fedora probably doesn't divert too much), # run rsyncd at a nice level? # ... RSYNC_NICE='' # run rsyncd with ionice? # ... # RSYNC_IONICE='-c3' makes me think that the *NICE values only affect the rsyncd daemon. Looking at /etc/init.d/rsync, we find if [ -s $RSYNC_DEFAULTS_FILE ]; then . ...


2

I can confirm that that doesn't work on my system either. The docs say "kernel 2.6.11 and up", and I'm on Fedora rawhide with kernel 2.6.38-rc6. I wonder if it is scheduler-dependent, and doesn't work with the introduced-in-2.6.23 CFQ ("Completely Fair Scheduler"). Something that will work, though, is the ...


2

As I mentioned, @glenn-jackman gave you the answer. But just to elaborate a bit more, if you wish to give higher priority to the command but do not intend to run it as root, you could use a function (and sudo): nice_cmd() { PRIORITY=$1 ; shift CMD=$1 ; shift ${CMD} $@ & cmdpid=$! sudo renice -n ${PRIORITY} -p ${cmdpid} } Then execute it as ...


2

In fact, RLIMIT_NICE allows you to bypass the basic rule that says that "a process can raise its nice value only if owned by root". Demonstration: # ulimit -e 30 # su nobody $ nice -n -10 top You will see that your top process runs with niceness -10. Now if you try nice -n -11 top, it will run with niceness 0, because -11 is not allowed by ...


2

Changing the nice level of a process is unlikely to affect the system load value. The system load value is the average length of the run queue, which is basically the number of processes wanting to use the CPU. If you are running a CPU-bound process (rsync isn't, but just for example), then it will always want to use CPU time whenever there is some ...


2

Using renice without sudo would be impossible. I quote from the renice(1) man page: Users other than the super-user may only alter the priority of processes they own, and can only monotonically increase their ``nice value'' (for security reasons) within the range 0 to PRIO_MAX (20), unless a nice resource limit is set (Linux 2.6.12 ...


2

*emphasized text*Since all the child processes are still a part of the session id (sess in ps output) we could exploit that fact using this command: $ parent=6187 $ ps -eo sess:1=,pid:1= |sed -n "s/^$parent //p" This should return to us all the process IDs of the child processes spawned from lb load. We can also get this directly from pgrep, using the -s ...



Only top voted, non community-wiki answers of a minimum length are eligible