Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
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. –  Harald Hanche-Olsen Jun 14 '12 at 19:59
    
@HaraldHanche-Olsen I would expect that aswell, but this question & comments suggest something less radical. –  gentmatt Jun 14 '12 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. –  Harald Hanche-Olsen Jun 14 '12 at 20:28

1 Answer 1

up vote 9 down vote accepted

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.

share|improve this answer
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. –  ؘؘؘؘ Jun 15 '12 at 11:55
    
Nice answer! And thanks for the bash command. –  gentmatt Jun 15 '12 at 15:06
    
@LauriRanta: Nice. I didn't try that. –  bahamat Jun 15 '12 at 18:04
    
@bahamat, thanks for the answer, but I wonder if you can say which version of OS X you tried this on. –  505 8 hours ago
    
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 8 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.