The answer of Graham Miln is very complete, there's just a few notes I'd like to add:
1) An app can support Automatic Termination or Sudden Termination or even both. The difference between these two is: With Automatic Termination the system can quit the app "at will" but it will quit it "normally" (just as if you choose Quit <AppName>
from the <AppName>
menu), allowing the app to perform some work on quit, so it can be restored back into that state when being reopened. With Sudden Termination, the system can "kill" the app "at will" without any chance for the app to perform any actions prior to dying as it will die instantly, which is much faster.
2) Apps can support either form of termination without declaring it in their Info.plist
file, so the grep
not listing an app doesn't mean the app won't support either feature. Actually the Info.plist
entry only changes the default behavior of an app. The default behavior is to support neither one, unless the code enables either one explicitly. When declared in their Info.plist
file, the behavior is the other way round: The declared feature is enabled by default, unless the code disables it explicitly.
3) The reason for controlling these features in code is that only the app itself can know if is currently really idle or actually waiting for some event to take place and thus must not die at the moment. So an app can temporary switch both off while waiting for something to happen or processing some data internally and then switch them back on once done.
4) In both cases, the system decides when to terminate an app and when not ("at will") and in many cases the system just doesn't want to as it has no reason to do so. E.g. if the system runs out of memory, it will aggressively look for apps it can terminate to quickly free up memory for those that shall continue to run but as long as there is no shortage, what advantage would it have for the system to kill these apps? Next time you use them they only need to be restarted which is a waste of processing time when there was no reason to quit them in the first place. And memory shortage is not defined by the amount of free memory you have (you have no shortage just because all memory seems in use) but by the so called "memory pressure". Activity Monitor can show you the memory pressure of your system. So just because an app supports either form of termination, it's not said that the system will actually make use of that feature.
5) With the introduction of XPC services in 10.8, some apps started to use these little helpers for performing their processing tasks. XPC Services implicitly support Sudden Termination. Despite belonging to an app, XPC Services don't display any UI (and don't show up in Dock), so you won't notice when they are started and when they are terminated. That means instead of having the system terminating the whole app to save resources, resource intense apps can use XPC Services and the system will terminate these XPC services if required which often makes it unnecessary for the app itself to support either form of termination as terminating the app will now hardly save the system a lot of resources if the main resource usage is caused by the XPC Services of that application.