nerdexam
GIAC

GSEC · Question #202

John works as a Network Administrator for Perfect Solutions Inc. The company has a Linux- based network. John is working as a root user on the Linux operating system. He is currently working on his C

The correct answer is C. nice -n -20 cc -c *.c &. On Linux, the nice value -20 represents the highest CPU scheduling priority, and only root can assign negative nice values.

Linux and Cryptography

Question

John works as a Network Administrator for Perfect Solutions Inc. The company has a Linux- based network. John is working as a root user on the Linux operating system. He is currently working on his C based new traceroute program. Since, many processes are running together on the system, he wants to give the highest priority to the cc command process so that he can test his program, remove bugs, and submit it to the office in time. Which of the following commands will John use to give the highest priority to the cc command process?

Options

  • Anice -n 19 cc -c *.c &
  • Bnice cc -c *.c &
  • Cnice -n -20 cc -c *.c &
  • Dnice cc -c *.c

How the community answered

(44 responses)
  • A
    2% (1)
  • B
    7% (3)
  • C
    80% (35)
  • D
    11% (5)

Why each option

On Linux, the nice value -20 represents the highest CPU scheduling priority, and only root can assign negative nice values.

Anice -n 19 cc -c *.c &

nice -n 19 sets the niceness to +19, which is actually the lowest CPU scheduling priority, the opposite of what is required.

Bnice cc -c *.c &

nice without a -n argument uses a default niceness of +10, which lowers priority relative to the default; it does not grant the highest priority.

Cnice -n -20 cc -c *.c &Correct

nice -n -20 sets the niceness to -20, which is the highest possible CPU scheduling priority in Linux. The & runs the compilation in the background, allowing John to continue other work. Because John is root, he is permitted to assign negative nice values, which are otherwise restricted for normal users.

Dnice cc -c *.c

nice cc -c *.c also uses the default niceness of +10 and additionally runs in the foreground, blocking the terminal without providing highest priority.

Concept tested: Linux nice command CPU priority management

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

Topics

#nice command#Linux process priority#process management#scheduling

Community Discussion

No community discussion yet for this question.

Full GSEC Practice