About Me

My photo
Santa Clarita, Ca, United States
I work as a Technology Manager in the Entertainment Industry. My first film was Disney's Dinosaur and have been credited on several films since. I love working on old electronics, especially old radios. I am also passionate about technology and education. I have 4 kids and you can read about us on our family blog.

Monday, February 6, 2012

Understanding Force Quit On The Mac

How many times have you had an application go haywire and then needed to "Force Quit".  Ever wondered what that means and why it is necessary?  You probably thought,  "why can't I just close the app and let it die?"   For those folks with a deep need to tinker and understand, this blog post is for you.

One of the greatest things Apple ever did was to decide to bring OSX to the macintosh.  OSX is based on the Unix operating system. Specifically, it's based on the NeXTSTEP OS which was a very special version of Unix tailored by Steve Job's NeXT corporation.

All versions of Unix allow "Pre-Emptive MultiTasking" which means many different processes can by many different users at the same time.  Apple OS X,  Linux, Sun Solaris, Cray Unicos, IBM AIX, HP uX, and any other version of Unix will support this feature.  The wonderful thing about this is that you can have one user running one process and another user running another process and they won't normally interfere with each other.

You actually can see this if you open a Terminal.  On your Mac, open Terminal and type "ps".  The "ps" command will show you all the processes that are running.

Every process has a "Process ID" that is given to it.  It also will have a parent process and the process ID of the parent is shown as well.

Though, sometimes, things go wrong. Sometimes a process will find a way to hog system resources or behave erratically. Sometimes, a process would go so wrong, that you had to force it to die.  For this reason, Unix needed a command to talk to send messages to the process, and, if necessary, shut the process down. So, the "kill" command was created.


Kill takes a "signal" which is sent to the process. If you just type "kill" and your process ID, that signal will be "SIGTERM" which tells the process to terminate. Though, if the process is really wedged tight, that won't be enough. So, there is a more lethal and powerful signal, "SIGKILL" which can not be ignored.  In unix, each signal has a number. For "SIGKILL" the number is 9 so a SIGKILL is usually referred to as a "kill -9".


When you are doing a "Force Quit" on the Mac, this is exactly what you are doing.  It's a "kill -9" wrapped in a nice user interface.  Though, if you wanted to play Unix Nerd, you could do the same thing from a shell.

The Kill Command

The Kill Command used to send a signal to a process. The signal sent might not necessarily be to terminate execution. The following table is a list of some of the signals supported.
SIGNAL NUMBER DEFAULT EVENT Explanation
HUP 1 Exit Hangup Tells the program to reread all of its configuration files.
INT 2 Exit Interrupt
QUIT 3 Core Quit Terminates Program and leaves a core file.
ILL 4 Core Illegal Instruction
TRAP 5 Core Trace/Breakpoint Trap
ABRT 6 Core Abort
EMT 7 Core Emulation Trap
FPE 8 Core Arithmetic Exception
KILL 9 Exit Killed Cannot be caught or ignored.
BUS 10 Core Bus Error When used with Celpaint, will cause it to save out the planes.
SEGV 11 Core Segmentation Fault Will cause Softimage, Maya and Photoshop to save out and then exit.
SYS 12 Core Bad System Call
PIPE 13 Exit Broken Pipe
ALRM 14 Exit Alarm Clock
TERM 15 Exit Terminated Terminates, but is more gentle. It gives the process a chance to clean up. This is the default.
USR1 16 Exit User Signal 1 Causes the font server to re read the configuration file.
USR2 17 Exit User Signal 2 Causes the font server to fluch the font cache.
CHLD 18 Ignore Child Status Changed
PWR 19 Ignore Power Fail/Restart
WINCH 20 Ignore Window Size Change
URG 21 Ignore Ugrent Socket Condition
POLL 22 Exit Pollable Event
IO 22 Exit input/output possible signal
STOP 23 Stop Stopped (Signal)
TSTP 24 Stop Stopped (User)
CONT 25 Ignore Continued
TTIN 26 Stop Stopped (tty input)
TTOU 27 Stop Stopped (tty output)
VTALRM 28 Exit

No comments:

Post a Comment

If you would like to reach out to the author directly, please email mschnitt@gmail.com