First, your computer may be restarting automatically because its overheating check your CPU tempreture and other computer parts.
Secondly, its very possible as mentioned above by JXY that you have a virus which causes your system log off on its own (thats assuming what you meant in the latest post before it was noted as double-post).
*Note: Next time specify what you downloaded or did any major changes recently which could cause this, plus your computer specs.