Regarding the command:
nice -5 /usr/bin/prog
Which of the following statements is correct?
Regarding the command:
nice -5 /usr/bin/prog
Which of the following statements is correct?
The nice command is responsible for adjusting the scheduling priority of a given process. In Unix-like operating systems, nice values range from -20 to +19, where lower numerical values indicate higher priority. In the command 'nice -5 /usr/bin/prog', the value '-5' is directly specified, indicating that the program '/usr/bin/prog' will be executed with a nice level of -5, giving it a higher priority compared to the default, which is typically 0. Hence, '/usr/bin/prog' will run with a nice level of -5.
B. /usr/bin/prog is executed with a nice level of 5. The -5 here indicates that the nice value is being increased by 5, which means that /usr/bin/prog will be less prioritized than other processes with lower nice values. The higher the nice value, the lower the CPU scheduling priority of the process. Remember that a negative nice value would require root privileges to apply, and it would mean a higher priority, not lower.
A. /usr/bin/prog is executed with a nice level of -5. Explanation: The nice command is used to execute a program with an adjusted scheduling priority (nice value). The nice value ranges from -20 to +19, where lower values indicate higher priority. In the given command, nice -5 /usr/bin/prog, the value -5 is specified as the nice level. This means that the program /usr/bin/prog will be executed with a nice level of -5, indicating a higher priority compared to the default value (usually 0). So, option A is correct: /usr/bin/prog is executed with a nice level of -5.
D would right answer. Any guess?
I would say it is B.
https://www.howtogeek.com/411979/how-to-set-process-priorities-with-the-nice-and-renice-commands-in-linux/ So the nice value is 5, so it's A.
Sorry, it's B. (a positive value), my typo
B is correct. to set -5 use nice --5 or nice -n 5
According to Ubuntu 20.04 the answer here is correct. The process has Nice level of 5 with that command.
Isn't the default NICE level 0? The first one is a nice value (niceness) which ranges from -20 (highest priority value) to 19 (lowest priority value) and the default is 0. if the default nice level is 0 and we execute a nice -5, the result should be -5. I'm I wrong? this is the second question i see about NICE levels and it seems everyone is assuming the default nice level to be 10 instead of 0. Can anyone clarify?
Forget my previous reply, the command "nice -5" will actually increase the nice to 5, so answer B is correct. tested in lab.
Default nice if command is used is 10, original priority or nice level if nice command is never used is 0, neutral.