Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm unfamiliar with how processes are killed in Windows. In Linux, a "warm" kill sends a signal (15) and the process can handle by instantiating a signal handler it and a cold kill sends signal (9) which the OS handles killing the process by force.

What is the procedure in Windows? How can I send a "kill" to a process? How does the process handle it? Is there a cross-platform way of responding to a kill/close request?

UPDATE: Clarification: The question is not on how to kill processes in Windows, but what actions the OS takes to carry this process. In Linux it is with signals where one allows a graceful exit.

share|improve this question
For readers: Signal 15 is SIGTERM, 9 is SIGKILL. – grawity Jun 16 '10 at 17:06
Please accept an answer, if your question has been answered. – Oliver Mar 15 '14 at 10:28

"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().

share|improve this answer
+1, WM_CLOSE sent to app; after X time ask user to force kill, Windows removes the process from the scheduler, closes all handles (which can trip up the process if the kernel is processing one of those handles), then reclaims the memory space (this is the really short version of the process). – Chris S Jun 16 '10 at 17:01
The third way is ntsd -p <pid> -c q, which uses the ntsd debugger; I'm not sure what happens when a program is killed that way. (pokes @Chris) – grawity Jun 16 '10 at 17:08
what happens if the program doesn't have a window? – IttayD Jun 18 '10 at 11:46
@IttayD: Then there's no entry in Task Manager to use "End Task" on :) I just tried taskkill and it replies with: "This process can only be terminated forcefully ( with /F option )." So yeah, the only choice left is TerminateProcess(). – grawity Jun 18 '10 at 20:20
@IttayD: Note that on Windows, services (daemons) are written differently from user applications; they can receive status queries and control requests from Service Manager, so a graceful stop is possible. – grawity Jun 18 '10 at 20:22

Sysinternals (now part of Microsoft) offers a utility called pskill which can be used from the command line to kill processes on the local system or on remote systems.

The usual way to kill processes in Windows in a GUI environment is to use the Task Manager.

share|improve this answer

with cygwin you can use a cross platform kill!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.