CPU is like heart of the computer machine. If such a problem is occurring with your computer, there might be some problem with CPU fan.
Open your cabinet box and there you will find a small fan. This fan is for removing heat from the CPU protecting it from overheating. Generally CPU operates around 40 degree centigrade. The temperature can reach up to 80 or more degrees depending upon processes and application going on in the computer. There is a upper limit for the temperature to raise. If the CPU touches that temperature, the computer shuts down immediately as that high temperature can damage the CPU.
To solve this problem make sure that the fan above CPU is rotating well. If it’s not the problem then the fan may have dust and dirt inside which prevents proper air ventilation and makes its difficult to remove heat from the CPU. Don’t try to remove the fan. Call your service provider and tell him to fix the problem. Fan must fit tightly above the CPU surface. A little space between the two can’t be tolerated. So don’t try to fix the fan yourself.
If the problem is still prevailing, then there is a problem with your CPU. If you are lucky, your may have warranty left for your system. Otherwise you need to spend on repairing or in worse condition buy a new one.