From hardware issues like heat or a poorly selected and overtaxed power supply to bad memory chip to software issues like PARASITES, worms, virus and just bad code, there is no single cure for this issue.
You will have to tell more about this with a lot more words to have the forum make a good guess.
I have this problem, my computer always hang and I have to press the restart button. Why computers will hang? What cos it to hang? How to prevent it from hanging? What should I do now?