OA. free
Free
MathWorks Embedded Systems Core Computer Science Medium

Question 8: Process Termination Signals Which of the below Signals is best to gracefully...

MathWorks technical mcq question, verified with a worked answer. Free to practise - no sign-up.

Question 8: Process Termination Signals

Which of the below Signals is best to gracefully terminate a process?

Choose one option.
Show answer & explanation
Answer: A. SIGTERM

SIGTERM (signal 15) is the standard termination signal that allows a process to catch, block, or ignore it, enabling graceful cleanup of resources and proper shutdown. SIGKILL cannot be caught or ignored and forces immediate termination. SIGSEGV indicates a segmentation fault (error condition). SIGINT is for user interruption (Ctrl+C) and is less formal than SIGTERM for programmatic termination.

Step-by-step Derivation:
Signal characteristics:

  • SIGTERM (15): Termination signal, catchable, allows cleanup → GRACEFUL
  • SIGKILL (9): Kill signal, uncatchable, immediate → FORCED
  • SIGSEGV (11): Segmentation fault, error condition → NOT FOR TERMINATION
  • SIGINT (2): Keyboard interrupt (Ctrl+C) → USER-INITIATED, NOT PROGRAMMATIC

For graceful termination, a process should receive a signal it can handle, perform cleanup (close files, flush buffers, save state), and exit cleanly. Only SIGTERM allows this behavior.