A computer typically freezes due to a software malfunction that causes the operating system to "hang." This may happen because of many possible reasons, including a memory leak, an infinite calculation, or another reason. A computer can also freeze because of a hardware malfunction, such as a bad RAM chip or a processor error.
Since computers are not supposed to freeze, a software crash is often due to a software programming error or unrecognizable input. Fortunately, modern operating systems, such as Mac OS X are designed so that if one program crashes, it will not affect other programs and the computer will not freeze.
If your computer does freeze, you will need to restart the computer to make it function again. You can typically force your computer to shut down by holding the power button for several seconds. And remember - since most computer freezes happen unexpectedly, it is a good idea to save your work frequently!