You might also try the following and see if it helps.
Select restart from the Apple menu. In the restart dialog, make sure "Reopen windows..." is not checked.
If you are running the latest Lion (and the freezes and forced restarts haven't messed up your system too much), that preference should become the default.
Next, in another thread, we should address the real issue: why does your iMac freeze? Unless you are using some very flakey software, this is not supposed to ever happen. I can't remember the last time it happened to me, and I use my machine extensively for some pretty hefty computations. It's been years, I think.
charlie