Ctrl+alt+del. Then go to processes and kill the one that crashed. That works on Windows, not sure if it works on MAC or Linux. On win7 and newer version, click on task Manager after you pressed the buttons I gave you.
The simplest way is to set up a watchdog program that polls the program's responsiveness (I wouldn't know how without knowing the program in question).
The issue with blindly killing a hung program is you'll never actually know what caused it. If you have a program that needs to be restarted automatically, you need to investigate why as you'll probably have a fairly major hardware/software issue!