How can the Task Manager in Windows or Force Quit in macOS close frozen, suspended, unresponding programs instantly. What do they do different than clicking the X button in the corner?

1.35K views

How can the Task Manager in Windows or Force Quit in macOS close frozen, suspended, unresponding programs instantly. What do they do different than clicking the X button in the corner?

In: Technology

18 Answers

Anonymous 0 Comments

Computers can only run one program at a time. This may seem strange, because it certainly looks like a computer runs many at once, but this is an illusion. Your computer achieves it by switching back and forth between many different programs at once. This is handled by the operating system, and there are a few different ways to do it, but most systems nowadays use a technique called *preemptive multitasking*, where the operating system handles everything automatically. Usually, even when one program hangs, it doesn’t affect other programs. The funny thing is, it’s also an illusion to the programs, which generally think they’re the only thing running on the machine.

So how does the computer manage all of this? It does so using program called a *process manager*, whose job it is to keep track of the other programs and make sure they stay organized. It coordinates with the deepest part of the operating system, the *kernel*, which, among other things, determines which programs are allowed to run and what they can access.

The reason all of this matters to your question is that the Quit command and the Force Quit button approach this problem from two very different angles. When you tell a program to quit, it’s supposed to run whatever kind of housekeeping it needs to, and then tell the operating system that it’s done. This lets the program clean up after itself, but if something goes wrong in that code (or was already going wrong even before then), it might never get to tell the operating system that it finished, and this looks like the program is just hanging.

The Force Quit button, by contrast, tells the process manager that this program is not allowed to run anymore, so please kick it out of the system *right now*. This works in most cases, and if it doesn’t then you usually have bigger problems. But it also means the program doesn’t get a chance to run its cleanup code (if it has any), so it is better to quit programs manually when you can. But sometimes you need a different way, and that’s where Force Quit is useful.

You are viewing 1 out of 18 answers, click here to view all answers.