LX0-103 · Question #127
Which of the following commands kills the process with the PID 123 but allows the process to "clean up" before exiting?
The correct answer is D. kill -TERM 123. SIGTERM is the standard signal for requesting graceful process termination, giving the process an opportunity to perform cleanup before exiting.
Question
Which of the following commands kills the process with the PID 123 but allows the process to "clean up" before exiting?
Options
- Akill -PIPE 123
- Bkill -KILL 123
- Ckill -STOP 123
- Dkill -TERM 123
How the community answered
(46 responses)- A4% (2)
- B2% (1)
- D93% (43)
Why each option
SIGTERM is the standard signal for requesting graceful process termination, giving the process an opportunity to perform cleanup before exiting.
SIGPIPE is sent when a process attempts to write to a broken pipe; it is not used to request process termination.
SIGKILL (signal 9) immediately and unconditionally terminates the process - it cannot be caught, blocked, or ignored, so no cleanup is possible.
SIGSTOP suspends (pauses) the process rather than terminating it; the process remains in memory and can be resumed with SIGCONT.
SIGTERM (signal 15) is the default termination signal and can be caught by the process, allowing it to run signal handlers that close files, release resources, or save state before exiting. This is distinct from forced termination because the process retains control over how it shuts down. kill -TERM 123 sends SIGTERM to PID 123, fulfilling the requirement for a clean shutdown.
Concept tested: Linux process signals and graceful termination
Source: https://man7.org/linux/man-pages/man7/signal.7.html
Topics
Community Discussion
No community discussion yet for this question.