Questions tagged [nice]

nice is a UNIX kernel call and the name of a utility employed to lower or raise a process' CPU priority.

nice is a program found on Unix and Unix-like operating systems such as Linux.

It directly maps to a kernel call of the same name. nice is used to invoke a utility or shell script with a particular priority, thus giving the process more or less CPU time than other processes. A niceness of −20 is the highest priority and 19 or 20 is the lowest priority. The default niceness for processes is inherited from its parent process, usually 0.

Source: Wikipedia

For questions about the Nice programming language, use .

101 questions
7
votes
1 answer

Understand what is using up "nice" CPU

I am running a small Cassandra cluster on Google Compute Engine. From our CPU graphs (as reported by collectd), I notice that a nontrivial amount of processor time is spent in NICE. How can I find out what process is consuming this? I've tried…
Ian Rose
  • 667
  • 1
  • 6
  • 18
7
votes
3 answers

Nice command in .sh script for Cron Jobs

I have this php script that I need to run on shared webhosting. I have created a cron job that executes an sh script. The command for the cron was: /bin/sh /home/user/script.sh So I'm assuming it is Bourne Shell (or something compatible). The script…
xlordvader
  • 118
  • 1
  • 8
7
votes
5 answers

Process niceness (priority) setting has no effect on Linux

I wrote a test program which consists of just an infinite loop with some computations inside, and performs no I/O operations. I tried starting two instances of the program, one with a high niceness value, and the other with a low niceness…
Hermann Speiche
  • 894
  • 1
  • 9
  • 16
6
votes
2 answers

How to programmatically run a command with low IO priority and high niceness value on OS X

Is there a way to basically call system(), but with a predefined niceness value (20) and low IO priority from Objective-C? (The low IO priority setting I'm talking about is the one launchd has) I'm trying to launch /usr/bin/purge from within my…
houbysoft
  • 32,532
  • 24
  • 103
  • 156
5
votes
4 answers

"nice" command not working on macOS

I'm trying to run a particular process that is using all the processor time using nice: sudo nice -n 20 someProcess Unfortunately, this doesn't change anything. In Activity Monitor, it's still pegging at 99% of the CPU. I was suspicious that this…
T. Reed
  • 181
  • 1
  • 9
5
votes
3 answers

Run high-priority sshd process without inheriting that priority to child process

I have given highest priority to sshd process using following command: nice -n -20 /sbin/sshd But it will give highest priority to child process (/bin/sh) also by default. So, is it possible to give normal priority (0) to child process instead of…
Rahul R Dhobi
  • 5,668
  • 1
  • 29
  • 38
4
votes
2 answers

How can I set negative niceness of a docker process?

I have a testenvironment for code in a docker image which I use by running bash in the container: me@host$ docker run -ti myimage bash Inside the container, I launch a program normally by saying root@docker# ./myprogram However, I want the process…
bitmask
  • 32,434
  • 14
  • 99
  • 159
4
votes
1 answer

Is there a way to "nice" a method of a Python script

My scripts have multiple components, and only some pieces need to be nice-d. i.e., run in low priority. Is there a way to nice only one method of Python, or I need to break it down into several processes? I am using Linux, if that matters.
CuriousMind
  • 15,168
  • 20
  • 82
  • 120
3
votes
1 answer

Decreasing nice value of a process

I created a process and inside I tried to decrease its nice value: #include #include #include #include #include int main() { printf("Modified nice value: \t %d\n",…
Gennaro Arguzzi
  • 769
  • 1
  • 14
  • 27
3
votes
1 answer

Nice / IOnice which one first? Does it matter? Any other way to reduce server load on a script?

I've been trying the "nicer" way to run a gzip from a bash script on an active server, but it somehow manages to get the load average above what I would wish it would be. Which of the following would be softer on the I/O and the CPU? Is there…
Karma Doe
  • 114
  • 12
3
votes
2 answers

How to change priority of make build process

We have a Linux server with multiple users logged in. If someone runs make -jN it hogs the whole server CPU usage and responsiveness to other users decreases drastically. Is there any way to decrease the priority of make process run by anyone in…
manav m-n
  • 11,136
  • 23
  • 74
  • 97
2
votes
1 answer

Specifying process priority in Ansible

Is it possible to specify the process priority for an Ansible task? The use case is setting a low priority for an expensive and long-running backup task. In a bash script I'd use nice for this. I did not find anything by searching using keywords…
Jeroen De Dauw
  • 10,321
  • 15
  • 56
  • 79
2
votes
1 answer

Manipulating thread's nice value

I wrote a simple program that implements master/worker scheme where the master is the main thread, and workers are created by it. The main thread writes something to a shared buffer, and the worker threads read this shared buffer, writing and…
Y.H.
  • 2,687
  • 1
  • 29
  • 38
2
votes
3 answers

Does "nice" affect the priority of Java threads

On a Unix system, you can run a process at lower CPU "priority" (pedantically, it does not change the thing that is called the priority, but rather influences what share of available CPU time is used, which is "priority" in the general sense) using…
Raedwald
  • 46,613
  • 43
  • 151
  • 237
2
votes
1 answer

In which condition "nice" command's return value will be 33?

"nice" command is returning value as 33. Please help me understand why nice is returning the value as 33. In some systems it works just fine giving return value as 0 but on a system it gives me return value as 33. nice -n -10
Aayush
  • 147
  • 1
  • 12