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.
Computer engineer here!
When you exit a program, it tries to do some clean up before it shuts down completely. If the program is already having problems, it may not even recognize that you asked it to shut down and never gets to that step. As a result, it either doesn’t quit or it takes a long time.
One of the things your operating system does is pause and resume different programs really quickly so that you can run multiple things at one time (like listen to music and surf the internet). When you kill a task through the task manager, you are telling the operating system to remove that task from its todo list and give back the RAM.
The simplest version is that the operating system controls virtually all access between software and the hardware. The application itself can send instructions to the operating system to say “Hey, I’m good to shut myself down”, which the operating system will then accept and process…killing the task. If you use Task Manager, you are more closely interacting with the operating system itself (technically, using a different application with higher privileges) – and your instruction is to “stop executing that task”, which the OS is happy to oblige, usually, and usually quickly.
The reasons why Task Manager is quicker at the job:
* if the application has any house cleaning to do before it shuts down like freeing up used memory or saving inprogress files it will complete them before asking to be shut down
* if it’s busy doing …whatever it is that it is supposed to do…or if anything has gone wrong and it’s stuck in an infinite loop – there may not be enough instruction cycles left for it to actively monitor the X button for clicks, so it never, or very slowly queues the command to shut itself down.
* Task manager doesn’t care about those things – it just looks at the list of tasks that get allocated processor time, and removes the task/threads associated. That program ceases to exist.
When you say ‘work better’ – it works better at killing the program more quickly, but can do damage to files that may be in the process of being written, only getting part of the data computed or stored before the app stops.
I’ll just throw in a Linux reference (I don’t know if this also applies to windows).
There are 3 main ways to terminate a program in Linux: from the program itself, with a signal, hard kill.
Within the program: programs often look for you to ask it to close. That might be pressing a key or clicking a button. The program has to specifically look for that happening. Sometimes there’s a bug in the program and it forgets to check for your request. In that case clicking the button or hitting the key does nothing.
Signal: the OS can interrupt the program and tell it to do something, this is called a signal. Signals can be sent in multiple ways, but the command “kill” is the typical way from the command line (despite the name, kill can send lots of different signals, not just the one for kill). Even if the program is stuck doing something, the OS forces it to stop that and do something else. That something else is called a handler and the program decides what it is. On Linux, the signal that tells the program to shut down is called SIGTERM. If all goes well, the program stops what it’s doing (even if there’s a bug and it normally couldn’t stop) and tries to shut down cleanly (just like the “within the program” case). The big difference here is that the OS interrupted the program rather than the program checking for your request itself.
Hard kill: if both of the above fail, it means the program has a big problem and can’t be trusted to shut down. In this case, we’re not even going to ask. No buttons, no signals. The OS just stops the program in its tracks and removes it from memory. This is done using another signal called SIGKILL. This signal is special because the program never even sees it, the OS does everything.
We prefer the first two methods because the program might want to save open files and generally clean up after itself. The last one is a last resort since the program doesn’t have a chance to do anything before it dies.
Latest Answers