7

How does the GUI interface for force quitting applications (++esc) work?

e.g. Does it work like killall Finder which would send a TERM signal by default?

3
  • 1
    I would expect it to send a KILL signal, possibly after trying less drastic signals first. Otherwise, a hung process might not be terminated after all. But I don't know what it actually does. Commented Jun 14, 2012 at 19:59
  • @HaraldHanche-Olsen I would expect that aswell, but this question & comments suggest something less radical.
    – gentmatt
    Commented Jun 14, 2012 at 20:02
  • 2
    Yeah, but it seems clear that Force Quit treats Finder differently. Just notice how the text of the “Force Quit” button changes when you choose the Finder. Or perhaps the problem is that Finder is stuck in an uninterruptible system call, in which case even a KILL signal will not work. Commented Jun 14, 2012 at 20:28

1 Answer 1

10

I just probed this with dtrace. The PID of the program in question is sent a SIGTERM (i.e., signal 15) from loginwindow.

I also tried this with a stopped process (sent SIGSTOP), so that the process showed as "Not Responding" in the Force Quit dialog and got the same result, loginwindow sends a SIGTERM.

If you want to try yourself, run the following in Terminal:

sudo /usr/sbin/dtrace -n 'proc:::signal-send /pid/ { printf("%s -%d %d",execname,args[2],args[1]->pr_pid); }'

You'll then see the name of the process sending the signal, the signal number and the PID the signal is sent to.

4
  • 1
    If you try force quitting a background processes (or an app that isn't shown in the Dock) from Activity Monitor, most of them seem to be sent a SIGKILL (-9) instead.
    – Lri
    Commented Jun 15, 2012 at 11:55
  • @LauriRanta: Nice. I didn't try that.
    – bahamat
    Commented Jun 15, 2012 at 18:04
  • @bahamat, thanks for the answer, but I wonder if you can say which version of OS X you tried this on. Commented Nov 28, 2014 at 0:40
  • Judging by when I originally posted this, I'd say it was 10.7.x. It still works on Yosemite. You need to be root or use sudo though.
    – bahamat
    Commented Nov 28, 2014 at 0:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .