Hold down the Command, Option and ESCape keys to bring up the Force Quit menu.

This will tell you if a program is not responding and causing your machine to hang.

Force Quit the offending program.