Leave well enough alone. Do not attempt to make changes to your fan's normal operation. Your problem most likely has another less damaging solution. Let's start with this:
Open Activity Monitor in the Utilities folder. Select All Processes from the Processes dropdown menu. Click twice on the CPU% column header to display in descending order. If you find a process using a large amount of CPU time, then select the process and click on the Quit icon in the toolbar. Click on the Force Quit button to kill the process. See if that helps. Be sure to note the name of the runaway process so you can track down the cause of the problem.
If nothing shows up above then try these:
Then restart in Safe Mode and operate for a while to determine if the problem persists. If it does then create a new user account. Log out of your normal account and into the new account. Does the problem persisit?
If none of the above are helpful then you need to reinstall OS X.
Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alterhatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list. In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive. If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu.
Reinstall Lion: Select Reinstall Lion and click on the Continue button.
Note: You can also re-download the Lion installer by opening the App Store application. Hold down the OPTION key and click on the Purchases icon in the toolbar. You should now see an active Install button to the right of your Lion purchase entry. There are situations in which this will not work. For example, if you are already booted into the Lion you originally purchased with your Apple ID or if an instance of the Lion installer is located anywhere on your computer.
You might want to check and see what the CPU is doing with Activity Monitor, as well as what it's temperature is with either the iStat Pro widget or Temperature Monitor application.iMac, Mac Mini, iPad, iPods, Mac OS X (10.6.8), Safari, iPhoto, iTunes, GarageBand
The SMC and PRAM were reset by me and by Apple Genius guys and didn't work.
There is not much application running. I always monitor the Active Monitor.
Once the problem happens, I closed every programs (CPU idle at 99%) and the fan still at 100% after one hour later. The back of the iMac is cool.
I reinstalled the Lion twice already.
When the fan goes 100%, iProStat and smcFanControl show that the CPU temp of 126 degree Celsius.
But Apple guys said, they can not trust the third party software.
I have no option but controlling the fan on my own.
That's a blazing hot reading, no wonder the Fan is out of control.
Sounds like a faulty secsor to me, I'd defiantly definitely get a second opinion from another Apple Service Provider or Service Tech.
I have iStat Pro already.
I just installed the Temperature Monitor, and the read is:
CPU A Hearsink 127 degree Celsius
Which is wrong.
But Apple guys said the sensor is OK.
Get a second opinion on the temperature from Temperature Monitor. Very well regarded for accuracy. If it's still that temp, that's completely out of control, as Dennis suggested. I wouldn't even use the computer until that's fixed.