How does Windows kill a process, exactly?
I'm unfamiliar with how processes are killed in Windows. In Linux, a "warm" kill sends a signal (15) which the process can handle by instantiating a signal handler. A cold kill is signal (9) which the OS handles by killing the process forcefully.
How can I "kill" a process in Windows? How is it handled by OS and by the process? What actions does OS perform? Is there a cross-platform way of responding to a kill/close request?
Solution 1:
"End Task" (and taskkill
) appears to post a WM_CLOSE
message to the program's windows. (The same is done when you click the × "Close" button.) If the program does not exit in some time, user gets prompted to end the program forcefully.
"Kill Process" and taskkill /f
use TerminateProcess()
.
- How To Terminate an Application "Cleanly" in Win32