Challenge, Easy,  on  LinuxProgramming

Kill a Stubborn Process with SIGKILL

When applications trap signals like SIGINT (Ctrl+C) or SIGTERM, they can intercept the signal and refuse to exit.

To handle rogue or unresponsive processes, the Linux kernel provides SIGKILL (Signal 9), the uncatchable signal that bypasses application code entirely and immediately reclaims process resources.

Signal Architecture

In this challenge, you will explore signal handling firsthand by launching a process that traps interrupt signals and terminating it with SIGKILL.


Task Instructions

  1. Start the Process: Execute ~/exercise/stubborn in your terminal (or run it in the background).
  2. Send SIGINT (Ctrl+C): Press Ctrl+C while the process is running (or send kill -2 <PID>). Observe how it catches the signal and refuses to quit.
  3. Terminate with SIGKILL: Use SIGKILL (kill -9 <PID> or pkill -9 stubborn) to force the process to exit (you can open a new terminal from the + icon on the terminal pane).

Hint: Need a Refresher on Signals?

Check out the tutorial Linux Processes: Understanding Signals to learn more about signals, signal handling, and SIGKILL.