PID1 and PID2 are running processes owned by the current user.
Use util-linux renice to set both nice values to the absolute value 12.
Which command is appropriate?
util-linux renice accepts multiple PIDs after --pid. --priority sets the resulting nice value as an absolute value.
Detailed explanation
nice -n 12 "$PID1" "$PID2"Incorrect. nice starts a command and does not modify existing PIDs.
Incorrect. nice starts a command and does not modify existing PIDs.
renice --relative 12 --pid "$PID1" "$PID2"Incorrect. --relative adds 12 to each current value rather than setting 12.
Incorrect. --relative adds 12 to each current value rather than setting 12.
renice --priority 12 --user "$PID1" "$PID2"Incorrect. --user selects a user criterion; these arguments are PIDs and the requested option is --pid.
Incorrect. --user selects a user criterion; these arguments are PIDs and the requested option is --pid.
renice --priority 12 --pid "$PID1" "$PID2"Correct. It sets both listed PIDs to nice value 12.
Correct. It sets both listed PIDs to nice value 12.
Try it yourself
An example you can run in a temporary verification environment.
sleep 1 & PID1=$!; sleep 1 & PID2=$!; renice --priority 12 --pid "$PID1" "$PID2" >/dev/null; ps -o ni= -p "$PID1","$PID2"; kill "$PID1" "$PID2"Expected result
12を2行(空白幅は環境により異なる)Key points
- renice modifies running processes
- --pid accepts multiple PIDs
- --priority is absolute
Notes
- Environment: util-linux 2.40以降 / procps-ng
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.