maybe ,also dirt/dust in fans ,heat up and shutdown also when its working go to mycomputer /right clcik choose properties ,advanced /in the startup and recovery section /system failure /,and uncheck auto restart ,you then should get a blue screen error ,make not of all it says to troubleshoot the cause of the restart
seem to me like a bad processor, Most likely overheating, or just plain dying. shut down and check heatsink grease, and heat on processor, if it's hot where you have to pull you have away very fast, there lies your culprit.
pc XP Pro mouse keyboard freezes up after 10-15 minutes, then machine reboots itself. Ram maybe??
.no chance of a positive assumption on such little info from poster .in my opinion ,my suggest in my first post is the easiest check as it will only take 15 min,and you just have to sit and wait for it to restart ,no need to take anything apart !!!!