What advantages does Ending Task have over Ending Process?
For programs having at least one window, End Task does the same as clicking the X "Close" button – it sends the WM_CLOSE
message to that window, asking it nicely to close. (For console windows, the equivalent is CTRL_CLOSE_EVENT
.) The program can prompt the user to save changes, or do various cleanup tasks. If the process complies, Task Manager waits a few seconds and proceeds with terminating the process if it is still running.
If the process is frozen or otherwise not handling window messages it receives, then, of course, neither End Task nor the Close button can work. In those cases, Windows will usually ask you to end the program forcefully, but only after giving the program sufficient time to respond.
Meanwhile, the End Process button does not concern itself with tasks or windows – it calls the TerminateProcess()
function and Windows destroys the process immediately, without notifying it or giving it any chance to clean up.
(Resources such as memory are released automatically once the process is gone; however, there might remain various temporary files if the program created them, and of course there's the risk of data corruption if the process is terminated in the middle of saving data.)
See also:
- Visual Studio Magazine. Kill an App Gently
The other two answers do a fine job of explaining what the difference is in terms of what happens, but just to put in perspective how they differ in terms of how it happens, the former tells the program to close while the latter tells Windows to kill the program.
As an analogy, it is like the difference between asking someone to gather their things and leave the room and telling a bouncer to immediately and forcibly shove them out.