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

The Task Manager in Windows (or Finder in macOS) communicate with programs by sending them *signals*. When a program receives a signal, it briefly pauses (gets *interrupted*) to respond to the signal.

There are a couple common signals an OS might send to a program:

* **SIGTERM**. (Terminate signal). This signal is a request for the program to exit gracefully. For example, the program could save its data to a file before exiting. It is functionally similar to a user issuing a File > Exit or Quit command. Note: since SIGTERM is only a request, a program could ignore this signal and continue processing. An unresponsive program will not be able to handle the signal, and therefore may fail to exit.
* **SIGKILL**. (Kill signal). This signal is sent to forcefully terminate a program. Unlike SIGTERM, SIGKILL is not a request and cannot be ignored by the program. SIGKILL always terminates a program unless there’s an operating system kernel bug or an extremely anomalous condition.

So if we take macOS’s Finder as an example, selecting Quit from the dock menu will cause a SIGTERM to be sent to the application’s main process, while selecting Force Quit sends a SIGKILL instead.

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