Exam LFCS All QuestionsBrowse all questions from this exam
Question 69

Regarding the command:

nice -5 /usr/bin/prog

Which of the following statements is correct?

    Correct Answer: A

    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.

Discussion
EliteAllenOption: B

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.

StribOption: A

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.

ignou143Option: D

D would right answer. Any guess?

9866666Option: B

I would say it is B.

MPA3333Option: A

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.

MPA3333

Sorry, it's B. (a positive value), my typo

IvandragoOption: B

B is correct. to set -5 use nice --5 or nice -n 5

vukOption: B

According to Ubuntu 20.04 the answer here is correct. The process has Nice level of 5 with that command.

Borbz

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?

Borbz

Forget my previous reply, the command "nice -5" will actually increase the nice to 5, so answer B is correct. tested in lab.

Funkslinger

Default nice if command is used is 10, original priority or nice level if nice command is never used is 0, neutral.