You can get a shutdown like that if the computer gets too hot. Make sure the air intakes on the bottom and the exhaust vent on the top are clean and are not blocked by something in your workspace like papers or the back of the computer being too close to part of the furniture. You need a good six inches (15cm) of clearance between the exhaust slot and other objects or surfaces.
Anti-virus/internet security software, especially the "pay for" kinds, can increase operating temps. So can third-party backup software furnished with many "name-brand" external hard drives.
Fan motors and/or temperature sensors can fail. If you have the original grey disks that shipped with your iMac, find the on that has Apple Hardware Test (AHT) and run it. If you have a failed heat sensor or fan motor, it will detect it with an error code containing "SNS" if it's a bad sensor or "MOT" if its a bad fan motor.
AHT instructions here:
http://support.apple.com/kb/HT1509
Also see if your iMac 27 falls under theis Apple Repair Extension Program:
iMac 1TB Seagate Hard Drive Replacement Program