Hot answers tagged

16

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 ...


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 ...


15

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 ...


12

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

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 ...


11

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 ...


11

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. ...


10

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.


9

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.


8

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


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 ...


7

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).


6

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 ................................................... ...


6

Internal niceness levels are 0-39, but increments are positive or negative. Source. So the answer is that the numbers (positive and negative) accepted by the nice command are what get you from 20, the default level, to anywhere in the 0-39 range. So why 0-39? The specific range was what worked in the designers' original implementation. The reason more ...


5

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 ...


5

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 ...


5

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 ...


5

The nice value will not tell you anything about the actual cpu load, a process produces. Nice-ness is just what you would think: the way, a process behaves under certain work loads. To be more exact: if a process with a high nice-value (==lower scheduling propability) is scheduled, it WILL hold the cpu, until a process with lower nice-value and/or ...


4

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 ...


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

*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 ...


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 ...


4

nice launches a new command with a modified nice level (lower priority than it would have otherwise had, or higher priority if you have permission). You specify which command to launch by providing it as an argument to nice itself. nice actually execs that command, so nice itself doesn't terminate until the command does. renice changes the priority of an ...


3

JIM=x JIM=20 nice -n 10 echo $JIM does pass the JIM=20 environment variable to nice, but it's not nice nor echo that expands $JIM, that's the shell. The shell forks a process and executes: execve("/usr/bin/nice", ["nice", "-n", "10", "echo", "x"], ["JIM=20", other vars]) nice sets the niceness and then executes in the same process: execve("/bin/echo", ...


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 ...


3

The sysvinit init.d scripts often use start-stop-daemon. You can modify them and add -N options to change the nice level of the daemons. Beside this, you can write your own script that renices the processes and call it in /etc/init.d/rc.local. There are also auto nice daemons (like AND) which can do this task automatically.


3

Negative nice values are reserved for system work. If you run a userland program with to high niceness, like -15, some kernel work that it relies on cannot run, so that the program stalls itself. The proper way to make your system usable again is to renice the other CPU hog to higher nice values. renice -n 5 otherpid


3

Answering the question you asked: to change the niceness of an existing process, call renice. That's per processĀ¹, not per session, so the tmux process is not directly relevant. Find the process ID of the crawler (e.g. with ps x on Linux, or with pstree) and call renice on it. However this won't help you because you made two incorrect assumptions: That ...



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