nerdexam
CompTIA

LX0-103 · Question #206

Regarding the command: nice -5 /usr/bin/prog Which of the following statements is correct?

The correct answer is B. /usr/bin/prog is executed with a nice level of 5.. The 'nice -5' command uses legacy syntax where '-5' is interpreted as a positive niceness increment of 5, raising the nice level to 5 and lowering process priority - not a negative value.

GNU and Unix Commands

Question

Regarding the command:

nice -5 /usr/bin/prog Which of the following statements is correct?

Options

  • A/usr/bin/prog is executed with a nice level of -5.
  • B/usr/bin/prog is executed with a nice level of 5.
  • C/usr/bin/prog is executed with a priority of -5.
  • D/usr/bin/prog is executed with a priority of 5.

How the community answered

(33 responses)
  • B
    94% (31)
  • C
    3% (1)
  • D
    3% (1)

Why each option

The 'nice -5' command uses legacy syntax where '-5' is interpreted as a positive niceness increment of 5, raising the nice level to 5 and lowering process priority - not a negative value.

A/usr/bin/prog is executed with a nice level of -5.

A nice level of -5 requires 'nice --5' or 'nice -n -5' with superuser privileges; 'nice -5' sets a positive increment of 5, not -5.

B/usr/bin/prog is executed with a nice level of 5.Correct

In the legacy 'nice' syntax, 'nice -N command' interprets N as a positive increment added to the default nice value of 0, yielding a nice level of 5. A negative nice value (higher priority) would require 'nice --5' or 'nice -n -5', both of which require root privileges.

C/usr/bin/prog is executed with a priority of -5.

Nice values and kernel internal priority are related but distinct concepts - 'nice' sets the niceness (scheduling hint), not a raw kernel priority value.

D/usr/bin/prog is executed with a priority of 5.

The kernel internal priority is derived from the nice level but is not the same numeric value and is not directly set by the 'nice' command.

Concept tested: Linux nice command niceness adjustment syntax

Source: https://man7.org/linux/man-pages/man1/nice.1.html

Topics

#nice#process priority#scheduling#nice level

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice