Why does ending a task from task manager work better than canceling a program?

719 views

When a computer starts to freeze or operate slowly and doesn’t respond, ending the task(s) from the task manager usually ends the program and the problem. Why does this work better than simply canceling the task with ALT+F4/pressing the cancel button in the window?

In: Technology

26 Answers

Anonymous 0 Comments

To understand this I think you want to understand what differentiate killing a task, sending a shutdown command and pressing the “X”.

A shutdown command (Pressing X, quit from the software, in some cases alt – f4) is like when the factory closes down at the end of the day. Workers will put tools back, turn of all machines calmly and orderly and clean up the work space. In computers that would be writing caches/deleting caches, writing saved setting to a config file, sending some data to a server, making sure open documents are saved.

A “kill” command, what task manager does, is like the fire alarm going off in a factory. Everyone just drops everything and runs out. (Maybe more accurately it would be like if someone just took the factory and launched into space with no traces left of it. The OS just drops the task associated with the application”)

Alt – F4 is a Windows OS specific shortcut that sends a kill command to currently focused window. Which is why it often doesn’t work for some application that fail to launch completely. Applications can be made to “intercept” this command though.

I don’t know the full technical details of how an OS handles the different terminate signals it can send, but I feel this analogy explains why task manager often works, it simply doesn’t do all the things a normal shutdown of an application does.

Anonymous 0 Comments

Because the “close” button asks politely, while the task manager is like [forcefully throwing somebody out of the door](https://www.youtube.com/watch?v=qvJeATp31dw).

In general you want the first one, because it allows things to finish in an orderly manner, and allows the program to ask “Do you want to save the last 6 hours of work?”

Anonymous 0 Comments

End task, alt+f4, and clicking the corner x all do the same thing. They politely ask the program to stop. The program will normally finish what it’s doing, maybe pop up a message asking if you want to save, and then close itself. This is usually the best way to close a program. It gives the program a chance to finish what it’s doing so everything works properly. But, if the program is already malfunctioning, like if it’s frozen, asking the program politely to close might not work, as it’s already too messed up to respond to requests.

End process is different. It just kills the program instantly. It doesn’t let the program finish what it is doing, it doesn’t let the program control how the program shuts down. It just stops everything instantly.

If your computer was a bar, most ways of closing a program would be like asking “We are closing soon, please finish your drink and leave.” Ending the process is like a bouncer physically picking up a patron and tossing him out the door: it works even if the patron is passed out drunk.

Anonymous 0 Comments

A lot of programs have what is called “shutdown hooks” which is basically a piece of code that does something when you click Close or Alt-F4. The easiest example is the dialog you get when closing browser (“Do you want to close multiple tabs?”) or when closing Word or Excel (“Do you want to save your changes?”). When the program freezes it can get blocked completely so the hooks are waiting for the program to unfreeze which it never will so the program can’t close at all.

Ending the program in task manager bypasses all that and “kills” the process (think depriving it of resources). So it’s more effective in closing the applications but can result in unwanted things, i.e. losing changes, stuff not being saved to DB, connections not closing properly etc.

Anonymous 0 Comments

Closing a program normally is like getting a valued guest to leave amicably when they’ve overstayed their welcome but it’s too awkward to bluntly tell them to leave.

Closing it via task manager is like telling them to fuck off and die and shooting them in the head.

Anonymous 0 Comments

Most relatable answer is Skype that doesn’t want to close after closing, so you TERMINATE the program by knocking it out with a roundhouse kick

Anonymous 0 Comments

I know others already talked detailly about the difference between cleaning up and close the program, and directly yeet the process to oblivion. But another thing is that usually when u need to use the task manager or any OS-level process manager to close a program, its because the program hanged.

In that case, asking the program politely to stop itself will not work as there is no free threads in that process that can handle the “close down the program” callback. Only an outsider (the OS) can directly shut down the process.

Using the factory analogy others used, when every worker in the factory is being unproductive and just shout at each other, adding to the chaos and shout “stop and leave” is not gonna work. Someone has to work from the outside, and probably just burn down the whole place.

But the problem with this is that all the previous work and products that those workers made that havent been shipped out of the factory are all gonna be lost (cuz they all got burned down). Similarly, all the previously done calculation and unsaved progress of applications are going to be lost after being terminated by the task manager. So all you got left after terminating Word is the autosaved version 10 minutes prior.

Anonymous 0 Comments

Closing a program the normal way is basically telling it “ok, finish up all the stuff you’re doing and get out of here”.

Killing the task (or better yet, process) says “I don’t care what you’re doing, get out now.”

Anonymous 0 Comments

X’ing out of a program means you are requesting that the program end itself. If the program isn’t working, it may not be able to do anything at all, including closing itself.

Using the Task Manager means you’re asking the computer to close the program. Your computer is still working, even if the program isn’t, so the computer can carry out the close command where the program can’t.

Anonymous 0 Comments

Alt+F4 is like asking a guest to leave.

Task Kill is picking them up and throwing them out the window.

Basically the OS sends a message saying “Stop what you are doing gracefully” (Alt+F4) and if it doesn’t it shoots it and attempts to clean up the body (Task Kill).