You can’t really do anything when your computer suddenly restarts. However, you can take measures to prevent the problem in the future. Start by figuring out what’s causing kernel panic and then go through a few steps to optimize your Mac’s performance.
Here’s what to do when your Mac keeps restarting.