Why is it that ending a task in XP/Vista takes so much longer than ending the underlying process itself? WHat's the relationship between a task and a process from an OS perspective?
migrated from stackoverflow.com Aug 10 '09 at 17:00
This question came from our site for professional and enthusiast programmers.
I believe ending the task requests the program to quit gracefully first, whereas ending the process is the Windows equivalent of SIGKILL - the OS just dumps the process with no questions asked.
"Task" is the term used by "Task Manager" to - justify its name - show the list of "main windows of the user's processes"(*), if any
"End Task" gives the "task" (message loop for the "main window") a last chance to react to the WM_CLOSE message and times-out on the associated process to finish.(http://blogs.msdn.com/oldnewthing/archive/2004/07/22/191123.aspx)
"End Process" is a rude TerminateProcess, discarding any pending changes to files or other resources.
Commonly, a mini-dump is created for a Microsoft Online Crash Analysis (Dr. Watson) report, which also might take a second or two.
(*) Raymond, I know this is so inaccurate.